Skip to content

Conversation

@AuHau
Copy link
Contributor

@AuHau AuHau commented Oct 24, 2025

Closes #1319

This PR:

  • adds ReachabilityManager which drives the decision making to make the node reachable by other peers in the network
  • adds AutoNAT integration that is patched into ReachabilityManager
  • refactors the port-mapping protocols (UPnP and NAT-PMP) integration into a more readable and focused component
  • integrates the port-mapping component into the ReachabilityManager

Current state of the PR is very WIP. Implementation is done, now make it compile and test it.

cc @emizzle

@github-actions github-actions bot added the feat label Oct 24, 2025
Copy link
Contributor

@emizzle emizzle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shaping up. Just a few suggestions so far

askNewConnectedPeers = true,
numPeersToAsk = 5,
maxQueueSize = 10,
minConfidence = 0.1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this will work, but could be useful so maxQueueSize can be changed without worrying about having to change minConfidence correctly.

Suggested change
minConfidence = 0.1,
minConfidence = 1 div maxQueueSize,

return failure("No internal ports to be mapped were supplied")

strategy = initProtocols(strategy)
if strategy == PortMappingStrategy.None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate from line 253-254?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it would seem like that, but no. The initProtocols() will return None if it did not manage to initialize any of the protocols. So, need to double-check that edge case.

except CancelledError as exc:
raise exc
except CatchableError as exc:
info "Failed to dial bootstrap nodes", err = exc.msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be at least a warning, no? Or does this only impact relay?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can change it to warn, but I guess there should be some errors coming from the DHT component when it can't actually bootstrap the connectivity to the bootstrap nodes...

Comment on lines 327 to 328
renewalThread = Thread[RenewelThreadArgs]()
renewalThread.createThread(renewPortMapping, (strategy, portMapping))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should utilise the taskpool started on the codex node, that is also used for erasure? This allows the user to set the number of threads from the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NAT Reachability indicators

3 participants