Skip to content

Commit

Permalink
cli: libp2p listen addresses
Browse files Browse the repository at this point in the history
Add a command line argument and default values for the libp2p multiaddr listen addresses.

Ref.: https://docs.libp2p.io/concepts/transports/listen-and-dial/
  • Loading branch information
ns4plabs committed Jan 5, 2024
1 parent 5067f27 commit 01ec4bd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
},

Check warning on line 195 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L185-L195

Added lines #L185 - L195 were not covered by tests
}

app.Commands = []*cli.Command{
{
Name: "gen-seed",
Expand Down Expand Up @@ -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")),

Check warning on line 294 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L294

Added line #L294 was not covered by tests
}

goLog.Debugf("Rainbow config: %+v", cfg)
Expand Down

0 comments on commit 01ec4bd

Please sign in to comment.