-
Notifications
You must be signed in to change notification settings - Fork 239
feat: add a hole punching protocol try use on nat traversal #4873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f46b1e0
to
f246fdd
Compare
c45b12b
to
d4e1331
Compare
eval-exec
reviewed
Apr 16, 2025
eval-exec
reviewed
Apr 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- util/gen-types/schemas/protocols.mol: Language not supported
9a32af6
to
344d4b0
Compare
63bd180
to
e2dcc08
Compare
quake
requested changes
May 23, 2025
05cbd3e
to
e3b00fd
Compare
quake
reviewed
May 24, 2025
network/src/protocols/hole_punching/component/connection_sync.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_request_delivered.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_sync.rs
Outdated
Show resolved
Hide resolved
e05a01e
to
0127d11
Compare
quake
requested changes
May 26, 2025
network/src/protocols/hole_punching/component/connection_request_delivered.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_request_delivered.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_request_delivered.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_request_delivered.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_sync.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_sync.rs
Outdated
Show resolved
Hide resolved
network/src/protocols/hole_punching/component/connection_sync.rs
Outdated
Show resolved
Hide resolved
4f296d8
to
56d6fb5
Compare
56d6fb5
to
4baa98d
Compare
quake
previously approved these changes
May 26, 2025
eval-exec
approved these changes
Jun 4, 2025
doitian
added a commit
that referenced
this pull request
Jun 6, 2025
feat: add a hole punching protocol try use on nat traversal closes #4824 #4766 This PR introduces a protocol to coordinate node connection behavior, attempting to perform TCP traversal through coordination: 1. Removed the `try dial observe address` behavior. 2. The protocol currently does not support the wasm target and does not support establishing WebSocket protocol connections. 3. The protocol has only three messages, with the following behavior: 1. Schedule finding peer IDs from the peer store that want to establish a connection and broadcasting their possible listening addresses. 2. The node receives a Request message and determines if the target object is itself. 1. If the `to` object is itself, it returns a Delivered message. 2. If the `to` object is not itself, it broadcasts the route and ttl modified. 3. The node receives a Delivered message response. 1. If the `from` object is itself, it starts a TCP connection request and responds with a Sync message 2. If the `from` object is not itself, it modifies the route and ttl and propagates the message to the next router object. 4. The node receives a Sync message response. 1. If the `to` object is itself, it starts a TCP connection request. 2. If the `to` object is not itself, it propagates the message to the next router object. ```mermaid sequenceDiagram participant A as Initiator Node A participant B as Relay Node B participant C as Target Node C autonumber A->>B: ConnectionRequest B->>C: Forward(ConnectionRequest) activate C C-->>C: Validate Target C->>B: ConnectionRequestDelivered (incl. Observed Addr) deactivate C B->>A: Forward(ConnectionRequestDelivered) activate A A-->>A: Process Reply (Store Observed Addr) Note right of A: Delay start early NAT<br/>traversal attempt here (ttl/2) A->>B: ConnectionSync deactivate A B->>C: Forward(ConnectionSync) par Start NAT Traversal & Direct Connection Attempt activate A A-->>A: Start NAT Traversal A-->>C: Direct Connection Attempt (e.g., TCP Hole Punching) deactivate A and activate C C-->>C: Start NAT Traversal C-->>A: Direct Connection Attempt (e.g., TCP Hole Punching) deactivate C end ``` Co-Authored-By: driftluo <[email protected]>
Already merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
close #4824 #4766
This PR introduces a protocol to coordinate node connection behavior, attempting to perform TCP traversal through coordination:
try dial observe address
behavior.to
object is itself, it returns a Delivered message.to
object is not itself, it broadcasts the route and ttl modified.from
object is itself, it starts a TCP connection request and responds with a Sync messagefrom
object is not itself, it modifies the route and ttl and propagates the message to the next router object.to
object is itself, it starts a TCP connection request.to
object is not itself, it propagates the message to the next router object.Check List
Tests
Release note