From 01ec4bd6f10d56e035fd1e3b2e6f854eeff7852e Mon Sep 17 00:00:00 2001 From: ns Date: Fri, 5 Jan 2024 18:52:24 +0000 Subject: [PATCH] cli: libp2p listen addresses Add a command line argument and default values for the libp2p multiaddr listen addresses. Ref.: https://docs.libp2p.io/concepts/transports/listen-and-dial/ --- main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 069bcf5..ed93ecd 100644 --- a/main.go +++ b/main.go @@ -182,8 +182,18 @@ Generate an identity seed and launch a gateway: EnvVars: []string{"RAINBOW_BLOCKSTORE"}, Usage: "Type of blockstore to use, such as flatfs or badger. See https://github.com/ipfs/rainbow/blockstore.md for more details", }, + &cli.StringFlag{ + Name: "listen-addrs", + Value: strings.Join([]string{"/ip4/0.0.0.0/tcp/4001", + "/ip4/0.0.0.0/udp/4001/quic-v1", + "/ip4/0.0.0.0/udp/4001/quic-v1/webtransport", + "/ip6/::/tcp/4001", + "/ip6/::/udp/4001/quic-v1", + "/ip6/::/udp/4001/quic-v1/webtransport"}, ","), + EnvVars: []string{"RAINBOW_LIBP2P_LISTEN_ADDRS"}, + Usage: "Multiaddresses for libp2p to listen on (comma-separated)", + }, } - app.Commands = []*cli.Command{ { Name: "gen-seed", @@ -281,6 +291,7 @@ share the same seed as long as the indexes are different. DHTSharedHost: cctx.Bool("dht-shared-host"), DenylistSubs: getCommaSeparatedList(cctx.String("denylists")), Peering: peeringAddrs, + ListenAddrs: getCommaSeparatedList(cctx.String("listen-addrs")), } goLog.Debugf("Rainbow config: %+v", cfg)