spolu/warp

How does warp's networking work?

Closed this issue · 10 comments

tbodt commented

The readme says it doesn't use a central server, how does it work?

I think it does use a central server. In the protocol.go you can see the server it's connecting to by default. Also, in the daemon you can see the server implementation.

From what I understood @nilbot is right that in the code source there is a default address warp.link:4242 but it seems more to be a development thing or a demo thing.
Users can update it by setting the environment var WARPD_ADDRESS.
Once the address updated this way to your own machine public address, clients should be able to connect to the warpd daemon that your machine is running.
Routing, firewalls problems have still to be addressed to my mind.

It may be worth looking at webrtc, there is a golang library for it (but it does require cgo if i remember correctly) and that gives you nice peer to peer connections.

the WARPD_ADDRESS is a mystery here which I believe does the nat-traversal etc, and it can also record all my screen which is a security concern, what is running at WARPD_ADDRESS?

@laoshaw I'm not too sure, although I have not read through the code in detail to say for sure, I think it's simply a web app model:

  • data communication whose security is backed by TLS, meaning on your development / demo server, you need to have a SAN certificate and the client is able to connect to it.
  • sharing is a pub/sub model. publisher is the warp opener. sub is all the other connections. data is replayed to all subs (session in the code, I presume)

therefore there is no NAT at all. It doesn't need to. It's a central server model.

Please correct me if I'm wrong.

@nilbot I just tested it from two peers both behind NAT, there is no way it can work without a server in the public domain that knows how to relay the traffic between two peers reliably

Your router handles the NAT, I believe that is what you mean given the context. The warpd server don't do NAT. If you can connect to IP:PORT using TCP then you are golden, however you get there, is your router / level 1 interconnect's job.

I'm talking about NAT-NAT traversal here, which normally needs a third-party server.

Yes I think that it really needs a third-party server too!

spolu commented

warp by default connects to warp.link:4242 (see protocol.go). The server address (running warpd) can be overridden with env variable WARPD_ADDRESS if you want to run your own warpd.