mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
This extracts the routing package to its own repository (https://github.com/ipfs/go-ipfs-routing). History has been preserved. The new module has been gx'ed and published. Imports have been rewritten and re-ordered accordingly. An internal dependency to go-ipfs/repo has been removed by substituting it with the go-datastore.Batching interface. License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
25 lines
708 B
Go
25 lines
708 B
Go
package bstest
|
|
|
|
import (
|
|
. "github.com/ipfs/go-ipfs/blockservice"
|
|
bitswap "github.com/ipfs/go-ipfs/exchange/bitswap"
|
|
tn "github.com/ipfs/go-ipfs/exchange/bitswap/testnet"
|
|
|
|
delay "gx/ipfs/QmRJVNatYJwTAHgdSM1Xef9QVQ1Ch3XHdmcrykjP5Y4soL/go-ipfs-delay"
|
|
mockrouting "gx/ipfs/QmZRcGYvxdauCd7hHnMYLYqcZRaDjv24c7eUNyJojAcdBb/go-ipfs-routing/mock"
|
|
)
|
|
|
|
// Mocks returns |n| connected mock Blockservices
|
|
func Mocks(n int) []BlockService {
|
|
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
|
|
sg := bitswap.NewTestSessionGenerator(net)
|
|
|
|
instances := sg.Instances(n)
|
|
|
|
var servs []BlockService
|
|
for _, i := range instances {
|
|
servs = append(servs, New(i.Blockstore(), i.Exchange))
|
|
}
|
|
return servs
|
|
}
|