Merge pull request #10149 from FlattestWhite/richard/make-user-agent-dependency-injectable
feat: Allow libp2p user agent to be overriden
This commit is contained in:
commit
7060150bdc
@ -67,9 +67,10 @@ var (
|
||||
ConnectionManagerKey = special{9} // Libp2p option
|
||||
AutoNATSvcKey = special{10} // Libp2p option
|
||||
BandwidthReporterKey = special{11} // Libp2p option
|
||||
ConnGaterKey = special{12} // libp2p option
|
||||
ConnGaterKey = special{12} // Libp2p option
|
||||
DAGStoreKey = special{13} // constructor returns multiple values
|
||||
ResourceManagerKey = special{14} // Libp2p option
|
||||
UserAgentKey = special{15} // Libp2p option
|
||||
)
|
||||
|
||||
type invoke int
|
||||
|
@ -69,6 +69,13 @@ func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (RawHost,
|
||||
return h, nil
|
||||
}
|
||||
|
||||
func UserAgentOption(agent string) func() (opts Libp2pOpts, err error) {
|
||||
return func() (opts Libp2pOpts, err error) {
|
||||
opts.Opts = append(opts.Opts, libp2p.UserAgent(agent))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func MockHost(mn mocknet.Mocknet, id peer.ID, ps peerstore.Peerstore) (RawHost, error) {
|
||||
return mn.AddPeerWithPeerstore(id, ps)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user