π WebRTC Native β’ π TLS 1.3 + Noise β’ β‘ 500 Mbps β’ π libp2p Compatible
Quick Start β’ Features β’ Architecture β’ Documentation β’ Contributing
- CMake 3.20+
- C++20 Compiler (GCC 11+, Clang 14+, MSVC 2022+)
- OpenSSL 3.0+
git clone https://github.com/hbliu007/peerlink.git
cd peerlink/p2p-cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
cd build && ctest -Vdocker run -it hbliu007/peerlink:latest- TLS 1.3 (
/tls/1.0.0) - Noise Protocol (
/noise)
- mplex (
/mplex/6.7.0) - yamux (
/yamux/1.0.0)
| Protocol | Description |
|---|---|
| TCP | IPv4/IPv6 |
| QUIC | UDP-based multiplexing |
| WebRTC | Browser-to-browser |
| WebTransport | HTTP/3-based |
- Kademlia DHT β Distributed hash table
- Bootstrap Nodes β Initial peer discovery
- GossipSub v1.1 β Scalable publish/subscribe
| Method | Description |
|---|---|
| STUN | NAT type detection |
| TURN | Relay fallback |
| ICE | Candidate gathering |
| Hole Punching | Direct connection |
| Metric | Value |
|---|---|
| P2P Throughput | 500 Mbps |
| Connection Latency | 20ms |
| Concurrent Connections | 10,000+ |
| Memory Usage | ~50 MB |
| Protocol | Throughput | Latency |
|---|---|---|
| TCP Direct | ~500 Mbps | ~20ms |
| QUIC | ~450 Mbps | ~15ms |
| WebRTC | ~400 Mbps | ~25ms |
| Relay (TURN) | ~50 Mbps | ~100ms |
peerlink/
βββ p2p-cpp/ # C++ Core Library
β βββ include/ # Public headers
β β βββ p2p/ # Core API
β β βββ core/ # Engine, connection, session
β β βββ crypto/ # TLS, Noise, Ed25519
β β βββ multiaddr/ # Multiaddr implementation
β β βββ net/ # Async I/O (Asio)
β β βββ protocol/ # libp2p protocols
β β βββ transport/ # TCP, QUIC, WebRTC
β βββ src/ # Implementation
β β βββ servers/ # STUN, TURN, Signaling, DID
β β βββ tests/ # Unit & integration tests
β βββ examples/ # Usage examples
βββ signaling-server-cpp/ # WebSocket signaling server
βββ docs/ # Architecture & API docs
#include <p2p/engine.hpp>
int main() {
p2p::Config config;
config.listen_addresses = {"/ip4/0.0.0.0/tcp/0"};
config.enable_webrtc = true;
auto engine = p2p::Engine::Create(config);
engine->Start();
auto conn = engine->Connect(p2p::PeerId::FromString("QmPeer..."));
conn->Send("Hello, P2P!");
engine->Stop();
return 0;
}Contributions are welcome!
git clone https://github.com/hbliu007/peerlink.git
git checkout -b feature/amazing-feature
cmake -B build -DBUILD_TESTS=ON
cmake --build build
git commit -m "feat: add amazing feature"
git push origin feature/amazing-featurePeerLink is licensed under the MIT License.
