Image of an arrow

Introducing DHTNet: Distributed Peer-to-Peer Networking Made Simple

Avatar

aberaud

Savoir-faire Linux is excited to announce DHTNet, a powerful new C++17 library spun off from the Jami project that simplifies peer-to-peer connectivity. DHTNet enables developers to establish secure P2P connections between devices using only public keys, eliminating the need for centralized infrastructure or direct IP addressing.

Features

  • Connection Management: DHTNet simplifies the establishment and management of connections to peers, streamlining the communication process.
  • Multiplexed Sockets: It provides multiplexed sockets that allow multiple channels for data transmission, optimizing network resources.
  • UPnP Integration: DHTNet seamlessly integrates with UPnP, enabling automatic port mapping and enhanced network connectivity.
  • Server TURN Support: DHTNet includes support for server TURN, used as a fallback for connections if the NAT block all possible connections.

Technical Overview

DHTNet is a C++17 library designed to serve as a network overlay that provides an IP network abstraction. Its main objective is to establish secure peer-to-peer connections using public-key authentication.

DHTnet allows you to connect with a device simply by knowing its public key and efficiently manages peer discovery and connectivity establishment, including NAT traversal.

At its core, DHTNet integrates several established standards and technologies to provide robust P2P connectivity:

  • OpenDHT serves as the foundation for peer discovery on the distributed network
  • ICE (Interactive Connectivity Establishment) is handled by pjnath, supporting connection through NATs and firewalls
  • Security and authentication are implemented through GnuTLS

The library implements a true peer-to-peer architecture where devices can discover and connect to each other through public key-based addressing. This approach eliminates the need for static IP addresses or central coordination servers, making it particularly suitable for dynamic network environments.

Use Cases and Applications

DHTNet is particularly well-suited for:

  • Embedded systems and IoT devices that require direct peer-to-peer communication
  • Distributed applications that need to operate without central infrastructure
  • Systems where traditional client-server architectures are impractical
  • Development of decentralized networking protocols and applications

Technical Requirements

  • Build tested with:
    • GCC on GNU/Linux
    • Clang on Android, iOS and macOS
    • MSVC on Windows
  • C++17 compatible compiler required
  • Dependencies:
    • OpenDHT
    • Our fork of pjproject, implementing ICE/TCP
    • GnuTLS

Contributing

DHTNet is an open-source project under the GPLv3+ licence, and contributions from the community are welcome. The codebase aims to maintain high standards of code quality and documentation to facilitate collaboration and maintainability.

Future Development

The development roadmap includes:

  • Additional transport protocol support
  • Enhanced API documentation
  • Performance optimizations for constrained environments
  • Extended example implementations

We encourage developers interested in distributed systems and peer-to-peer networking to explore DHTNet and provide feedback on its functionality and potential improvements.

https://github.com/savoirfairelinux/dhtnet/

https://github.com/savoirfairelinux/dhtnet/blob/master/BUILD.md

Leave a comment

Your email address will not be published. Required fields are marked *


Similar articles

Image of an arrow

Optimizing YOLO Training for Real-Time Detection on a LiDAR system This is the second of a three-part series on real-time YOLO detection on a LiDAR system for Edge AI. Find Article 1 on generating synthetic depth and NIR datasets here. Currently, new low-resolution embedded LiDAR such as the VL53L9CX, are emerging as a highly suitable […]

Enable Real-time Detection with Synthetic LiDAR Data Generation This series of articles will cover the essential components required to build real-time detection on a system with a dToF 3D LiDAR module. This first article is focused on synthetic LiDAR data generation. Synthetic LiDAR data generation for real-time detection Real-time Detection on a LiDAR System: Training […]

Accelerating early Linux boot with Yocto multiconfig By Paul Le Guen de Kerneizon Introduction In embedded products, cutting seconds, or even hundreds of milliseconds, from power‑on to application readiness is often critical. In this article, I will present a practical workflow to measure, compare, and iteratively reduce the early boot window of a Linux embedded […]

In today’s world, where everything from coffee machines to industrial equipment is connected to the network, knowing and assessing the security of your software and its dependencies has never been more important. Most vulnerabilities originate from small bugs in software components, and more recently (and thankfully less frequently) from sophisticated supply chain attacks. But with […]