make libp2p user agent overridable
This commit is contained in:
parent
34576d0c64
commit
a8dace0f23
@ -66,9 +66,10 @@ var (
|
|||||||
ConnectionManagerKey = special{9} // Libp2p option
|
ConnectionManagerKey = special{9} // Libp2p option
|
||||||
AutoNATSvcKey = special{10} // Libp2p option
|
AutoNATSvcKey = special{10} // Libp2p option
|
||||||
BandwidthReporterKey = special{11} // Libp2p option
|
BandwidthReporterKey = special{11} // Libp2p option
|
||||||
ConnGaterKey = special{12} // libp2p option
|
ConnGaterKey = special{12} // Libp2p option
|
||||||
DAGStoreKey = special{13} // constructor returns multiple values
|
DAGStoreKey = special{13} // constructor returns multiple values
|
||||||
ResourceManagerKey = special{14} // Libp2p option
|
ResourceManagerKey = special{14} // Libp2p option
|
||||||
|
UserAgentKey = special{15} // Libp2p option
|
||||||
)
|
)
|
||||||
|
|
||||||
type invoke int
|
type invoke int
|
||||||
|
@ -114,3 +114,10 @@ func NilRouting(mctx helpers.MetricsCtx) (BaseIpfsRouting, error) {
|
|||||||
func RoutedHost(rh RawHost, r BaseIpfsRouting) host.Host {
|
func RoutedHost(rh RawHost, r BaseIpfsRouting) host.Host {
|
||||||
return routedhost.Wrap(rh, r)
|
return routedhost.Wrap(rh, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UserAgentOption(agent string) func() (opts Libp2pOpts, err error) {
|
||||||
|
return func() (opts Libp2pOpts, err error) {
|
||||||
|
opts.Opts = append(opts.Opts, libp2p.UserAgent(agent))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user