-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add IPv6 support #5758
feat: add IPv6 support #5758
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
"port6", | ||
"discoveryPort6", | ||
] as (keyof typeof muArgs)[]) { | ||
validateMultiaddrArg(muArgs, key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this allows us to fail fast if the user sets an incorrect ip address or port
eg: --listenAddress ::
and --listenAddress6 0.0.0.0
should error
@@ -63,7 +120,7 @@ export function parseArgs(args: NetworkArgs): IBeaconNodeOptions["network"] { | |||
: null, | |||
maxPeers: maxPeers ?? defaultOptions.network.maxPeers, | |||
targetPeers: targetPeers ?? defaultOptions.network.targetPeers, | |||
localMultiaddrs: [`/ip4/${listenAddress}/tcp/${tcpPort}`], | |||
localMultiaddrs: [localMu, localMu6].filter(Boolean) as string[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libp2p was already configured to listen to an array of multiaddrs.
So nothing further than passing both multiaddrs here needs to be done.
bindAddrs: { | ||
ip4: (workerData.bindAddrs.ip4 ? multiaddr(workerData.bindAddrs.ip4) : undefined) as Multiaddr, | ||
ip6: workerData.bindAddrs.ip6 ? multiaddr(workerData.bindAddrs.ip6) : undefined, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discv5 5.0.0 now requires bindAddrs to be passed in like so.
So we thread this through to the cli layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for comments and outlining configuration options, behavior sounds good to me
* feat: add IPv6 support * fix: ip -> ip4 * fix: add parens * fix: update cli flag descriptions
🎉 This PR is included in v1.10.0 🎉 |
Motivation
Description
--listenAddress6
,--port6
,--discoveryPort6
port6
anddiscoveryPort6
follow the same behavior asport
anddiscoveryPort
port6
is 9090listenAddress
norlistenAddress6
is set, a defaultlistenAddress
will be usedlistenAddress
orlistenAddress6
is set explicitly, only those that are set will be used--port 9090
- listen on IPv4 on port 9090 for both libp2p and discv5 connections, no IPv6--listenAddress6 :: --port6 9000
- listen on IPv6 on port 9000 for both libp2p and discv5 connections, no IPv4--listenAddress 0.0.0.0 --listenAddress6 ::
- listen on IPv4 on port 9000, IPv6 on port 9090 for both libp2p and discv5 connections