chore: add `agent-string` flag

This commit is contained in:
Richard Ramos 2022-10-26 09:28:28 -04:00 committed by RichΛrd
parent 77df9a2224
commit a60213b14b
4 changed files with 13 additions and 1 deletions

View File

@ -187,6 +187,12 @@ func main() {
Value: &options.LogEncoding,
},
},
&cli.StringFlag{
Name: "agent-string",
Value: "go-waku",
Usage: "client id to advertise",
Destination: &options.UserAgent,
},
&cli.BoolFlag{
Name: "relay",
Value: true,

View File

@ -152,6 +152,10 @@ func Execute(options Options) {
libp2pOpts = append(libp2pOpts, libp2p.NATPortMap()) // Attempt to open ports using uPNP for NATed hosts.)
}
if options.UserAgent != "" {
libp2pOpts = append(libp2pOpts, libp2p.UserAgent(options.UserAgent))
}
if options.Websocket.Enable {
nodeOpts = append(nodeOpts, node.WithWebsockets(options.Websocket.Address, options.Websocket.WSPort))
}

View File

@ -152,6 +152,7 @@ type Options struct {
LogEncoding string
NAT string
PersistPeers bool
UserAgent string
Websocket WSOptions
Relay RelayOptions

View File

@ -405,7 +405,8 @@ var DefaultLibP2POptions = []libp2p.Option{
libp2p.ChainOptions(
libp2p.Transport(tcp.NewTCPTransport),
libp2p.Transport(quic.NewTransport),
), libp2p.UserAgent(userAgent),
),
libp2p.UserAgent(userAgent),
libp2p.ChainOptions(
libp2p.Muxer("/yamux/1.0.0", yamux.DefaultTransport),
libp2p.Muxer("/mplex/6.7.0", mplex.DefaultTransport),