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