mirror of https://github.com/status-im/nim-eth.git
bind to any address for listening (#20)
This commit is contained in:
parent
9146e8e2f0
commit
a69e52bf3e
|
@ -83,7 +83,8 @@ proc listeningAddress*(node: EthereumNode): ENode =
|
|||
return initENode(node.keys.pubKey, node.address)
|
||||
|
||||
proc startListening*(node: EthereumNode) =
|
||||
let ta = initTAddress(node.address.ip, node.address.tcpPort)
|
||||
# TODO allow binding to specific IP / IPv6 / etc
|
||||
let ta = initTAddress(IPv4_any(), node.address.tcpPort)
|
||||
if node.listeningServer == nil:
|
||||
node.listeningServer = createStreamServer(ta, processIncoming,
|
||||
{ReuseAddr},
|
||||
|
|
|
@ -257,7 +257,8 @@ proc processClient(transp: DatagramTransport,
|
|||
debug "Receive failed", err = getCurrentExceptionMsg()
|
||||
|
||||
proc open*(d: DiscoveryProtocol) =
|
||||
let ta = initTAddress(d.address.ip, d.address.udpPort)
|
||||
# TODO allow binding to specific IP / IPv6 / etc
|
||||
let ta = initTAddress(IPv4_any(), d.address.udpPort)
|
||||
d.transp = newDatagramTransport(processClient, udata = d, local = ta)
|
||||
|
||||
proc lookupRandom*(d: DiscoveryProtocol): Future[seq[Node]] {.inline.} =
|
||||
|
|
|
@ -14,7 +14,7 @@ type
|
|||
clientId*: string
|
||||
connectionState*: ConnectionState
|
||||
keys*: KeyPair
|
||||
address*: Address
|
||||
address*: Address # The external address that the node will be advertising
|
||||
peerPool*: PeerPool
|
||||
|
||||
# Private fields:
|
||||
|
|
Loading…
Reference in New Issue