Leveraging libp2p to solve NAT traversal & replace TURN in Jami

Hello everyone,

I recently wrote an article analyzing why Jami sometimes struggles in modern networks (especially with CGNAT and DPI), and suggested some architectural improvements: Habr.

In the comments, someone mentioned libp2p – a modular toolkit for building P2P applications (used in IPFS, Ethereum). After reading about it, I was surprised to see that many of the features I proposed (like peer relaying instead of TURN, built-in QUIC support, advanced NAT traversal) already exist in libp2p out of the box.

I’m not a developer, so I can’t judge how hard it would be to integrate, but it seems like libp2p could solve a lot of the network issues Jami faces today.

Has the team ever considered using libp2p as a foundation, or borrowing some of its ideas (like Circuit Relay for decentralized TURN replacement)?

I’d be happy to help test any experimental builds in difficult Russian networks (CGNAT, DPI) if that’s useful.

Thanks for your work on Jami!

A commenter in your Habr article mentioned another possible solution, the Yggdrasil network.

Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 network. It is lightweight, self-arranging, supported on multiple platforms and allows pretty much any IPv6-capable application to communicate securely with other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet connectivity - it also works over IPv4.

Yggdrasil is a new experimental compact routing scheme. It is designed to be a future-proof and decentralised alternative to the structured routing protocols commonly used today on the Internet, as well as an enabling technology for future large-scale mesh networks. Yggdrasil is:

  • Scalable
    Supports large, complex or even Internet-scale topologies
  • Self-healing
    Network responds quickly to connection failures or mobility events
  • Encrypted
    Traffic sent across the network is always fully end-to-end encrypted
  • Peer-to-peer
    Works entirely ad-hoc by design with no built-in points of centralisation
  • Cross-platform
    Supported on Linux, macOS, Windows, iOS, Android and more

Should this be added as an issue using the following guide?

I understand the appeal of Yggdrasil as a quick solution. But my main interest, as I’ve said, is to make Jami a self-sufficient and free tool, independent of any external ‘overlays’. This is precisely why libp2p is so interesting to me — it embeds itself inside and becomes a part of Jami, rather than another layer.

After all, if we are ready to tolerate external dependencies, why not just use Keet, which already has all of this implemented? But Keet is closed, while Jami is open. It is precisely this openness and self-sufficiency that is its main advantage, which we must preserve and strengthen, not dilute.

I’ve created an official feature request on GitLab based on our discussion: issue. Everyone interested, please feel free to comment and upvote there to show your support!