go-libp2p-tls icon indicating copy to clipboard operation
go-libp2p-tls copied to clipboard

handle TCP simultaneous open (option 4)

Open marten-seemann opened this issue 6 years ago • 5 comments
trafficstars

As described in https://github.com/libp2p/specs/pull/227#discussion_r349905051.

marten-seemann avatar Nov 24 '19 10:11 marten-seemann

Another concern here is that we need to signal the role to the multiplexer, at least in the case of yamux. We might have to change the interface to return the role, or maybe we should change the transport upgrader to select based on the peer IDs. @stebalien thoughts?

vyzo avatar Nov 25 '19 20:11 vyzo

@vyzo I can see two ways to do implement the signaling:

  1. Add a IsClient() bool function the SecureConn interface, or
  2. change the function signature of SecureOutbound to SecureOutbound(context.Context, net.Conn, peer.ID) (SecureConn, bool /*is client */, error).

I think that 2. would be the cleaner solution. Option 1. would also add IsClient() to all interfaces that build on top of SecureConn, and it's not clear if that function actually makes sense on those interfaces. For example, a stream multiplexer might decide to initialize itself in client mode on the server side, and in server mode on the client side.

marten-seemann avatar Nov 26 '19 09:11 marten-seemann

Agreed, option 2 is what I chose for multiselect/1.1.

vyzo avatar Nov 26 '19 11:11 vyzo

@vyzo Sounds good. Where can I see the code for ms-1.1? Can you give me a link the corresponding PRs?

marten-seemann avatar Nov 26 '19 11:11 marten-seemann

https://github.com/libp2p/go-libp2p/issues/712 collects all the PRs together.

vyzo avatar Nov 26 '19 11:11 vyzo