Why so many servers?

Joe Nelson joe at begriffs.com
Mon May 4 22:58:45 UTC 2020


> > As an interesting experiment, I'm wondering if anyone wants to try
> > ICE/STUN with me and see if we can open a direct TCP connection
> > between our computers?

Forest Johnson wrote:
> I would do this! I was meaning to start developing and prototyping a
> simple p2p VPN soon.

Given this is something you're planning to work on, do you want to take
the lead in this investigation? Just tell me what to do on my end and
I'll help you debug.

> > In an ideal world I wouldn't need any server, but could use a native
> > chat application and "call" another person directly with their IP
> > address.
> 
> I don't think that's possible unless one person has a public IP (no
> NAT). There has to be some sort of session establishment mechanism,
> otherwise the router being connected to wont know which LAN address to
> forward the connect packet to.

My understanding is that you designate a certain port, and tell the
router to forward packets hitting that port to a particular computer in
the LAN. So the public IP that an outsider connects to would be the
address of the router.

> > Anybody have suggestions for more cool p2p software?
> 
> I don't think you can talk about p2p in 2020 without talking about IPFS.
> I really like the ideas behind IPFS and I want to build software using it.

Decentralized content-addressable storage certainly goes back earlier
than $CURRENT_YEAR. I remember Freenet from twenty years ago doing a
similar thing. IPFS is probably more efficient though.
https://freenetproject.org/

> To make it even better, the IPFS project made the decision to split
> a large part of their code base into a separate project called libp2p.

Nice tip. Libp2p has a good description of NAT traversal too.
https://docs.libp2p.io/concepts/nat/

They do kind of use their own system though.  Rather than STUN they use
the "identity protocol," and rather than TURN they use the "circuit
relay protocol." They also rely on the SO_REUSEPORT option to
setsockopt() which isn't in POSIX.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html

It is available in Linux and BSD though:

https://lwn.net/Articles/542629/
https://man.openbsd.org/setsockopt

The LWN article is interesting because they motivate why the option was
created, and there's some pushback in the comments.


More information about the Friends mailing list