hashicorp / yamux

Golang connection multiplexing library
Mozilla Public License 2.0
2.25k stars 236 forks source link

Need some documentation on how to use NAT traversal feature #60

Closed codervinod closed 2 years ago

codervinod commented 6 years ago

I am trying to build a small client server, where the server is reachable via client, however client is not reachable via server. We need both ways duplex streams where either side can initiate a connection and send messages. Looking at documentation it seems YAMUX will fit this use case, however I dont see how this could be achieved. Any guidance will be helpful.

jen20 commented 6 years ago

Hi @codervinod! Sorry for the delay in answering this. Sorry to be the bearer of bad news here, but I'm not sure that Yamux will buy you anything, other than the multiplexing of streams once a connection is established. Nothing in Yamux will allow you to initiate a connection from a server to a client which is not reachable because of NAT.

That said, if you have a connection opened by the client, you could add new streams originating from the server, multiplexed over the same connection -- but this library just provides a framing format over an existing transport.