mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-19 17:58:23 +00:00
allow setting advertised external ip
* detect it in start.sh
This commit is contained in:
parent
2bc632c29b
commit
d7f972a47e
@ -60,6 +60,10 @@ type
|
|||||||
desc: "UDP listening port",
|
desc: "UDP listening port",
|
||||||
defaultValue: config.defaultPort().}: int
|
defaultValue: config.defaultPort().}: int
|
||||||
|
|
||||||
|
nat* {.
|
||||||
|
desc: "Specify method to use for determining public address. Must be one of: any, extip:<IP>"
|
||||||
|
defaultValue: "any" .}: string
|
||||||
|
|
||||||
validators* {.
|
validators* {.
|
||||||
required
|
required
|
||||||
desc: "Path to a validator private key, as generated by validator_keygen"
|
desc: "Path to a validator private key, as generated by validator_keygen"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import
|
import
|
||||||
options, chronos, json_serialization,
|
options, chronos, json_serialization, strutils,
|
||||||
spec/digest, version, conf
|
spec/digest, version, conf
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -19,6 +19,14 @@ when useRLPx:
|
|||||||
|
|
||||||
template libp2pProtocol*(name, version: string) {.pragma.}
|
template libp2pProtocol*(name, version: string) {.pragma.}
|
||||||
|
|
||||||
|
func parseNat(nat: string): IpAddress =
|
||||||
|
# TODO we should try to discover the actual external IP, in case we're
|
||||||
|
# behind a nat / upnp / etc..
|
||||||
|
if nat.startsWith("extip:"):
|
||||||
|
parseIpAddress(nat[6..^1])
|
||||||
|
else:
|
||||||
|
parseIpAddress("127.0.0.1")
|
||||||
|
|
||||||
proc writeValue*(writer: var JsonWriter, value: BootstrapAddr) {.inline.} =
|
proc writeValue*(writer: var JsonWriter, value: BootstrapAddr) {.inline.} =
|
||||||
writer.writeValue $value
|
writer.writeValue $value
|
||||||
|
|
||||||
@ -36,7 +44,7 @@ when useRLPx:
|
|||||||
|
|
||||||
let
|
let
|
||||||
keys = KeyPair(seckey: privKey, pubkey: privKey.getPublicKey())
|
keys = KeyPair(seckey: privKey, pubkey: privKey.getPublicKey())
|
||||||
address = Address(ip: parseIpAddress("127.0.0.1"),
|
address = Address(ip: parseNat(conf.nat),
|
||||||
tcpPort: Port conf.tcpPort,
|
tcpPort: Port conf.tcpPort,
|
||||||
udpPort: Port conf.udpPort)
|
udpPort: Port conf.udpPort)
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ DATA_DIR=$SIMULATION_DIR/node-${1}
|
|||||||
|
|
||||||
V_PREFIX="$VALIDATORS_DIR/v$(printf '%06d' ${1})"
|
V_PREFIX="$VALIDATORS_DIR/v$(printf '%06d' ${1})"
|
||||||
PORT=$(printf '5%04d' ${1})
|
PORT=$(printf '5%04d' ${1})
|
||||||
|
MYIP=$(curl -s ifconfig.me)
|
||||||
|
|
||||||
$BEACON_NODE_BIN \
|
$BEACON_NODE_BIN \
|
||||||
--network:ephemeralNetwork \
|
--network:ephemeralNetwork \
|
||||||
@ -30,5 +31,6 @@ $BEACON_NODE_BIN \
|
|||||||
--validator:${V_PREFIX}9.privkey \
|
--validator:${V_PREFIX}9.privkey \
|
||||||
--tcpPort:$PORT \
|
--tcpPort:$PORT \
|
||||||
--udpPort:$PORT \
|
--udpPort:$PORT \
|
||||||
|
--nat:extip:$MYIP \
|
||||||
--stateSnapshot:$SNAPSHOT_FILE \
|
--stateSnapshot:$SNAPSHOT_FILE \
|
||||||
$BOOTSTRAP_NODES_FLAG
|
$BOOTSTRAP_NODES_FLAG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user