diff --git a/node/builder.go b/node/builder.go index ddba82112..1e4ea0400 100644 --- a/node/builder.go +++ b/node/builder.go @@ -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 diff --git a/node/modules/lp2p/host.go b/node/modules/lp2p/host.go index 2d441eb3f..f529574f7 100644 --- a/node/modules/lp2p/host.go +++ b/node/modules/lp2p/host.go @@ -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) }