Skip to content
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

Set SO_REUSEPORT and remove port translation. #1667

Closed
wants to merge 3 commits into from

Conversation

dvc94ch
Copy link
Contributor

@dvc94ch dvc94ch commented Jul 17, 2020

So with this patch I was able to get ipfs-embed to traverse the nat in netsim-embed [0]. The outgoing port is hard coded to 31333 which is the port used by ipfs-embed by default. Since there may be multiple listeners it's unclear which port should be used for outgoing connections. Note that the example only works sometimes, other times it deadlocks and times out.

The first listener that works for the dialing address is used by the swarm when dialing. If no local_addr is provided the transport selects a suitable one.

@dvc94ch dvc94ch marked this pull request as ready for review July 18, 2020 22:58
@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jul 21, 2020

So this feature needs more work. While implementing a simple dial back protocol to test if nat traversal works I noticed that you need to disable port reuse when dialing, because otherwise it will fail. Any thoughts on how it should work?

Well we can retry without port reuse. The problem is if both parties try to open a connection at the same time, they'll both fail.

For the dial back protocol, since there already is an open connection the dial failed callback won't be called, so either a timeout is required or maybe a custom protocols handler. Not really sure how those work yet.

@dvc94ch dvc94ch mentioned this pull request Jul 22, 2020
@dvc94ch
Copy link
Contributor Author

dvc94ch commented Jul 28, 2020

@tomaka so what's the solution here? Wait for quic to land and use quick by default?

@dvc94ch dvc94ch closed this Oct 1, 2020
@dvc94ch dvc94ch mentioned this pull request Oct 9, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant