On Monday, 28 April 2014 at 18:36:59 UTC, Radu wrote:
I've seen vibe.d has some pretty nice features when it comes to asynchronous I/O but does someone know of an example of a STUN/TURN server written in it, or in plain D?

Every time I read anything related to STUN/TURN, it becomes obvious that these technologies were designed by some committee. Metric tons of technical jargon and bureaucratic overhead with an absurdly overcomplicated protocol to achieve such a simple thing.

I implemented basic concept behind the TURN server, a TCP relay:

http://worms2d.info/WormNAT2

The protocol is much simpler. As soon as a connection is received, it allocates a port and sends it to the client. This is the public port allocated for the connection - peers wishing to connect to the client can connect to that port on the relay server and talk as if they were talking to the client directly. Every time a peer connects, the server allocates a temporary port for the client to connect to, and sends it over the original control connection. After the client connects to said port, they can start talking to the peer directly, as if there's no proxy in-between. This avoids complicated handshakes, headers, and having to modify your protocol and wrap every single packet in a stupid header. It's also based on TCP, so you don't have to reimplement reordering, retransmission etc. on top of UDP all over again.

It's not open-source, and although I could share the source code, it's not Vibe'd (D1 in fact). The implementation is very simple, though.

Reply via email to