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 hacdias committed May 24, 2024
1 parent ed0d3d3 commit 3ee547b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The following emojis are used to highlight certain changes:
### Added

- Now supports remote backends (using RAW block or CAR requests) via `--remote-backends` (`RAINBOW_REMOTE_BACKENDS`).
- Added configurable libp2p listen addresses for the Bitswap host via the `libp2p-listen-addrs` flag and `RAINBOW_LIBP2P_LISTEN_ADDRS` environment variable

### Changed

Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,17 @@ Generate an identity seed and launch a gateway:
}
},
},
&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{
Expand Down Expand Up @@ -429,6 +440,7 @@ share the same seed as long as the indexes are different.
RemoteBackendMode: RemoteBackendMode(cctx.String("remote-backends-mode")),
GCInterval: cctx.Duration("gc-interval"),
GCThreshold: cctx.Float64("gc-threshold"),
ListenAddrs: cctx.StringSlice("libp2p-listen-addrs"),
}

var gnd *Node
Expand Down

0 comments on commit 3ee547b

Please sign in to comment.