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 authored and aschmahmann committed May 24, 2024
1 parent ed0bbe5 commit 406318d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ The following emojis are used to highlight certain changes:

### Added

- Added configurable libp2p listen addresses for the Bitswap host via the `libp2p-listen-addrs` flag and `RAINBOW_LIBP2P_LISTEN_ADDRS` environment variable

### Changed

### Removed
Expand Down
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,18 @@ Generate an identity seed and launch a gateway:
EnvVars: []string{"RAINBOW_IPNS_MAX_CACHE_TTL"},
Usage: "Optional cap on caching duration for IPNS/DNSLink lookups. Set to 0 to respect original TTLs",
},
&cli.StringSliceFlag{
Name: "libp2p-listen-addrs",
Value: cli.NewStringSlice("/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 bitswap client to listen on (comma-separated)",
},
}

app.Commands = []*cli.Command{
{
Name: "gen-seed",
Expand Down Expand Up @@ -367,6 +377,7 @@ share the same seed as long as the indexes are different.
SeedPeeringMaxIndex: cctx.Int("seed-peering-max-index"),
GCInterval: cctx.Duration("gc-interval"),
GCThreshold: cctx.Float64("gc-threshold"),
ListenAddrs: cctx.StringSlice("listen-addrs"),

Check warning on line 380 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L380

Added line #L380 was not covered by tests
}

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

0 comments on commit 406318d

Please sign in to comment.