-
Notifications
You must be signed in to change notification settings - Fork 37
add user-defined conn select alg and user-defined dest select alg #114
base: master
Are you sure you want to change the base?
Conversation
I wonder if we should just add options to the With respect to this code, this is going to be pretty buggy. We have a lot of code that expects that we'll only have one in-progress dial to a given peer at a time. A correct solution is going to require quite a bit of work. |
@lnykww we have a WIP PR that modularises the dialer (#88) so that applications (and subsystems like autorelay) can modify the behaviour. Under that model, you could inject a |
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.
What's the context for this? It needs a whole coordination protocol if we are to do hole punching, and I am not convinced a direct dial is the solution -- let alone that our current multistream protocol can't handle simultaneous open...
I believe this is just for "dial back". That is, if I'm NATed and I get an incoming connection via a relay, I can "dial back" to could a direct connection. However, I can't currently do that without closing the existing connection first. Ideally, I'd be able to create this new connection and then the swarm would prefer it for new streams (well, ideally we'd migrate...). |
@Stebalien I will think carefully about how to do this place. And create the v2 version.
@raulk |
@vyzo
UPDATE: Details of the protocol:
It doesn't support Symmetric NAT now. And it was test on Restrict NAT And Port Restrict NAT. |
You are right. We have dialed using the listen port, so for hole punching, we just want both ends connect peer use ob addrs at same time. And for quic reuse port, i will create a PR later. |
@Stebalien @vyzo @raulk This PR, I add some interface let user can choose the best connection and best destination address. |
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.
this seems incomplete. What are the actual implementations of these interfaces?
@vyzo See this commit lnykww/go-libp2p@87aa364 It Implement the interface at Punch.go |
When we turn on autorelay, the machines behind the NAT will use the relay to establish the connection. At this time we do hole punching, we need to establish a new connection instead of the relay connection. So we need dial direct to some addrs and ignore there is already a connection(witch is relayed) for the peer in swam.