File tree Expand file tree Collapse file tree
rocketpool/assets/install Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1365,6 +1365,20 @@ func (cfg *RocketPoolConfig) GetExternalIp() string {
13651365 return ip .String ()
13661366}
13671367
1368+ // Used by text/template to format eth2.yml when IPv6 is enabled.
1369+ // Lodestar requires --enr.ip6 and Teku requires --p2p-advertised-ips to advertise IPv6 in their ENR.
1370+ // Returns the external IPv6 address, or empty string if unavailable.
1371+ func (cfg * RocketPoolConfig ) GetExternalIpv6 () string {
1372+ consensusConfig := externalip.ConsensusConfig {Timeout : 3 * time .Second }
1373+ ip6Consensus := externalip .DefaultConsensus (& consensusConfig , nil )
1374+ ip6Consensus .UseIPProtocol (6 )
1375+ ip , err := ip6Consensus .ExternalIP ()
1376+ if err != nil || ip .To4 () != nil {
1377+ return ""
1378+ }
1379+ return ip .String ()
1380+ }
1381+
13681382// Gets the tag of the cc container
13691383// Used by text/template to format eth2.yml
13701384func (cfg * RocketPoolConfig ) GetBeaconContainerTag () (string , error ) {
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ if [ "$CC_CLIENT" = "lighthouse" ]; then
100100 fi
101101
102102 if [ " $ENABLE_IPV6 " = " true" ]; then
103- CMD=" $CMD --listen-address :: --port6 $BN_P2P_PORT --enr-udp6-port $BN_P2P_PORT --quic-port6 ${BN_P2P_QUIC_PORT:- 8001} "
103+ CMD=" $CMD --listen-address 0.0.0.0 --listen-address :: --port6 $BN_P2P_PORT --enr-udp6-port $BN_P2P_PORT --quic-port6 ${BN_P2P_QUIC_PORT:- 8001} "
104104 fi
105105
106106 exec ${CMD}
@@ -149,7 +149,10 @@ if [ "$CC_CLIENT" = "lodestar" ]; then
149149 fi
150150
151151 if [ " $ENABLE_IPV6 " = " true" ]; then
152- CMD=" $CMD --listenAddress6 :: --port6 $BN_P2P_PORT "
152+ CMD=" $CMD --listenAddress 0.0.0.0 --listenAddress6 :: --port6 $BN_P2P_PORT --quicPort6 ${BN_P2P_QUIC_PORT:- 8001} "
153+ if [ ! -z " $EXTERNAL_IP6 " ]; then
154+ CMD=" $CMD --enr.ip6 $EXTERNAL_IP6 "
155+ fi
153156 fi
154157
155158 if [ ! -z " $CHECKPOINT_SYNC_URL " ]; then
@@ -323,10 +326,8 @@ if [ "$CC_CLIENT" = "teku" ]; then
323326
324327 if [ " $ENABLE_IPV6 " = " true" ]; then
325328 CMD=" $CMD --p2p-interface=0.0.0.0,:: --p2p-port-ipv6=$BN_IPV6_P2P_PORT "
326- if [ ! -z " $EXTERNAL_IP " ]; then
327- if expr " $EXTERNAL_IP " : ' .*:' > /dev/null; then
328- CMD=" $CMD --p2p-advertised-ip=$EXTERNAL_IP "
329- fi
329+ if [ ! -z " $EXTERNAL_IP6 " ]; then
330+ CMD=" $CMD --p2p-advertised-ips $EXTERNAL_IP ,$EXTERNAL_IP6 --p2p-advertised-port-ipv6=$BN_IPV6_P2P_PORT "
330331 fi
331332 fi
332333
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ services:
8383 - ENABLE_METRICS= {{.EnableMetrics }}
8484 - BN_METRICS_PORT= {{.BnMetricsPort }}
8585 - EXTERNAL_IP= {{.GetExternalIp }}
86+ {{- if .IsIPv6Enabled }}
87+ - EXTERNAL_IP6= {{.GetExternalIpv6 }}
88+ {{- end }}
8689 - ENABLE_IPV6= {{.IsIPv6Enabled }}
8790 - CHECKPOINT_SYNC_URL= {{.ConsensusCommon.CheckpointSyncProvider }}
8891 - DOPPELGANGER_DETECTION= {{.IsDoppelgangerEnabled }}
You can’t perform that action at this time.
0 commit comments