Use the specified extip address in the advertised ENR records
This commit is contained in:
parent
425b0e13da
commit
fa0f3b4468
|
@ -16,7 +16,7 @@ export
|
|||
|
||||
proc new*(T: type Eth2DiscoveryProtocol,
|
||||
conf: BeaconNodeConf,
|
||||
rawPrivKeyBytes: openarray[byte]): T =
|
||||
ip: IpAddress, rawPrivKeyBytes: openarray[byte]): T =
|
||||
# TODO
|
||||
# Implement more configuration options:
|
||||
# * for setting up a specific key
|
||||
|
@ -25,7 +25,7 @@ proc new*(T: type Eth2DiscoveryProtocol,
|
|||
pk = initPrivateKey(rawPrivKeyBytes)
|
||||
db = DiscoveryDB.init(newMemoryDB())
|
||||
|
||||
newProtocol(pk, db, Port conf.tcpPort, Port conf.udpPort)
|
||||
newProtocol(pk, db, ip, Port conf.tcpPort, Port conf.udpPort)
|
||||
|
||||
proc toENode*(a: MultiAddress): Result[ENode, cstring] =
|
||||
if not IPFS.match(a):
|
||||
|
|
|
@ -156,7 +156,7 @@ when networkBackend in [libp2p, libp2pDaemon]:
|
|||
# are running behind a NAT).
|
||||
var switch = newStandardSwitch(some keys.seckey, hostAddress,
|
||||
triggerSelf = true, gossip = false)
|
||||
result = Eth2Node.init(conf, switch, keys.seckey.asEthKey)
|
||||
result = Eth2Node.init(conf, switch, extIp, keys.seckey.asEthKey)
|
||||
else:
|
||||
let keyFile = conf.ensureNetworkIdFile
|
||||
|
||||
|
|
|
@ -220,11 +220,11 @@ proc runDiscoveryLoop*(node: Eth2Node) {.async.} =
|
|||
await sleepAsync seconds(1)
|
||||
|
||||
proc init*(T: type Eth2Node, conf: BeaconNodeConf,
|
||||
switch: Switch, privKey: keys.PrivateKey): T =
|
||||
switch: Switch, ip: IpAddress, privKey: keys.PrivateKey): T =
|
||||
new result
|
||||
result.switch = switch
|
||||
result.peers = initTable[PeerID, Peer]()
|
||||
result.discovery = Eth2DiscoveryProtocol.new(conf, privKey.data)
|
||||
result.discovery = Eth2DiscoveryProtocol.new(conf, ip, privKey.data)
|
||||
result.wantedPeers = conf.maxPeers
|
||||
|
||||
newSeq result.protocolStates, allProtocols.len
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f1acc470eb01a4d9086e752d103a73e49a372eaf
|
||||
Subproject commit b9315ced4e2d7926737dab73b2374543088e17fd
|
|
@ -1 +1 @@
|
|||
Subproject commit 5aebab3f41834505af7c694f8caf2e8c9c5716cc
|
||||
Subproject commit 74d0247e6b69bf45d4e53c27e0089d5bb35b29ed
|
|
@ -1 +1 @@
|
|||
Subproject commit e7a34b74f298eaabd7bdbe2f080bf9747ed6bfd9
|
||||
Subproject commit 5fb40e4ffd2c5a7eca88203d99150e2d99732e41
|
Loading…
Reference in New Issue