Merge remote-tracking branch 'origin/testnet/3' into feat/check-deps
This commit is contained in:
+4
-1
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/peerstore"
|
||||
"github.com/libp2p/go-libp2p-core/routing"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
|
||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||
record "github.com/libp2p/go-libp2p-record"
|
||||
@@ -81,6 +82,7 @@ var (
|
||||
BaseRoutingKey = special{7} // fx groups + multiret
|
||||
NatPortMapKey = special{8} // Libp2p option
|
||||
ConnectionManagerKey = special{9} // Libp2p option
|
||||
AutoNATSvcKey = special{9} // Libp2p option
|
||||
)
|
||||
|
||||
type invoke int
|
||||
@@ -160,7 +162,7 @@ func libp2p() Option {
|
||||
|
||||
Override(new(lp2p.RawHost), lp2p.Host),
|
||||
Override(new(host.Host), lp2p.RoutedHost),
|
||||
Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(false)),
|
||||
Override(new(lp2p.BaseIpfsRouting), lp2p.DHTRouting(dht.ModeAuto)),
|
||||
|
||||
Override(DiscoveryHandlerKey, lp2p.DiscoveryHandler),
|
||||
Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)),
|
||||
@@ -174,6 +176,7 @@ func libp2p() Option {
|
||||
Override(NatPortMapKey, lp2p.NatPortMap),
|
||||
|
||||
Override(ConnectionManagerKey, lp2p.ConnectionManager(50, 200, 20*time.Second, nil)),
|
||||
Override(AutoNATSvcKey, lp2p.AutoNATService),
|
||||
|
||||
Override(new(*pubsub.PubSub), lp2p.GossipSub()),
|
||||
|
||||
|
||||
@@ -118,3 +118,7 @@ func (a *MpoolAPI) MpoolGetNonce(ctx context.Context, addr address.Address) (uin
|
||||
func (a *MpoolAPI) MpoolSub(ctx context.Context) (<-chan api.MpoolUpdate, error) {
|
||||
return a.Mpool.Updates(ctx)
|
||||
}
|
||||
|
||||
func (a *MpoolAPI) MpoolEstimateGasPrice(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error) {
|
||||
return a.Mpool.EstimateGasPrice(ctx, nblocksincl, sender, gaslimit, tsk)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/libp2p/go-libp2p-core/peerstore"
|
||||
dht "github.com/libp2p/go-libp2p-kad-dht"
|
||||
dhtopts "github.com/libp2p/go-libp2p-kad-dht/opts"
|
||||
protocol "github.com/libp2p/go-libp2p-protocol"
|
||||
record "github.com/libp2p/go-libp2p-record"
|
||||
routedhost "github.com/libp2p/go-libp2p/p2p/host/routed"
|
||||
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
|
||||
@@ -71,16 +71,20 @@ func MockHost(mn mocknet.Mocknet, id peer.ID, ps peerstore.Peerstore) (RawHost,
|
||||
return mn.AddPeerWithPeerstore(id, ps)
|
||||
}
|
||||
|
||||
func DHTRouting(client bool) interface{} {
|
||||
func DHTRouting(mode dht.ModeOpt) interface{} {
|
||||
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host RawHost, dstore dtypes.MetadataDS, validator record.Validator, nn dtypes.NetworkName) (BaseIpfsRouting, error) {
|
||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||
|
||||
d, err := dht.New(
|
||||
ctx, host,
|
||||
dhtopts.Client(client),
|
||||
dhtopts.Datastore(dstore),
|
||||
dhtopts.Validator(validator),
|
||||
dhtopts.Protocols(build.DhtProtocolName(nn)),
|
||||
dht.Mode(mode),
|
||||
dht.Datastore(dstore),
|
||||
dht.Validator(validator),
|
||||
dht.ProtocolPrefix(protocol.ID(nn)),
|
||||
dht.QueryFilter(dht.PublicQueryFilter),
|
||||
dht.RoutingTableFilter(dht.PublicRoutingTableFilter),
|
||||
dht.DisableProviders(),
|
||||
dht.DisableValues(),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -35,4 +35,6 @@ func AutoNATService(quic bool) func(repo repo.Repo, mctx helpers.MetricsCtx, lc
|
||||
}
|
||||
*/
|
||||
|
||||
var AutoNATService = simpleOpt(libp2p.EnableNATService())
|
||||
|
||||
var NatPortMap = simpleOpt(libp2p.NATPortMap())
|
||||
|
||||
Reference in New Issue
Block a user