You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd/devp2p: support dual-stack discovery listener (#35220)
`devp2p discv4 listen` / `discv5 listen` is the supported replacement
for the removed bootnode tool, but it bound IPv4-only and `-extaddr`
took a single address, so it couldn't run a dual-stack bootnode.
This binds the listener dual-stack (falling back to IPv4-only where IPv6
is unavailable) and lets `-extaddr` take a comma-separated IPv4/IPv6
pair. A single node can then advertise both `ip` and `ip6` in its ENR
over one UDP port:
```
devp2p discv4 listen --nodekey <key> --addr [::]:30301 \
--extaddr 203.0.113.10:30301,[2001:db8::1]:30301
```
The fallback IP is only derived from the listener when no `-extaddr` is
given, so a v4- or v6-only `-extaddr` no longer leaks a loopback entry.
All addresses must share one UDP port (single socket).
Copy file name to clipboardExpand all lines: cmd/devp2p/discv4cmd.go
+42-18Lines changed: 42 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ var (
126
126
}
127
127
extAddrFlag=&cli.StringFlag{
128
128
Name: "extaddr",
129
-
Usage: "UDP endpoint announced in ENR. You can provide a bare IP address or IP:port as the value of this flag.",
129
+
Usage: "UDP endpoint announced in ENR. You can provide a bare IP address or IP:port as the value of this flag. Provide a comma-separated pair to announce both an IPv4 and an IPv6 endpoint.",
130
130
}
131
131
crawlTimeoutFlag=&cli.DurationFlag{
132
132
Name: "timeout",
@@ -344,36 +344,60 @@ func parseExtAddr(spec string) (ip net.IP, port int, ok bool) {
0 commit comments