mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-05-12 06:19:33 +00:00
Add abstraction for reachable nodes
This commit is contained in:
parent
42ced01893
commit
4a453c53e0
@ -401,6 +401,12 @@ proc setupAddress*(
|
||||
of NatStrategy.NatUpnp, NatStrategy.NatPmp:
|
||||
return setupNat(natConfig.nat, tcpPort, udpPort, clientId)
|
||||
|
||||
proc findReachableNodes*(bootstrapNodes: seq[SignedPeerRecord]): seq[SignedPeerRecord] =
|
||||
## Returns the list of nodes known to be directly reachable.
|
||||
## Currently returns bootstrap nodes. In the future, any network participant
|
||||
## confirmed reachable by AutoNAT could be included.
|
||||
bootstrapNodes
|
||||
|
||||
proc nattedAddress*(
|
||||
natConfig: NatConfig, addrs: seq[MultiAddress], udpPort: Port
|
||||
): tuple[libp2p, discovery: seq[MultiAddress]] =
|
||||
|
||||
@ -111,7 +111,7 @@ proc start*(s: StorageServer) {.async.} =
|
||||
|
||||
await s.storageNode.start()
|
||||
|
||||
for spr in s.config.bootstrapNodes:
|
||||
for spr in findReachableNodes(s.config.bootstrapNodes):
|
||||
try:
|
||||
let addrs = spr.data.addresses.mapIt(it.address)
|
||||
await s.storageNode.switch.connect(spr.data.peerId, addrs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user