@@ -19,6 +19,7 @@ A high-performance VPN tunnel implementation written in Rust.
1919- 🔐 ** Secure by Default** - AEAD encryption (ChaCha20-Poly1305), perfect forward secrecy, replay protection
2020- 🚀 ** Simple & Easy** - Minimal configuration, straightforward CLI, quick deployment
2121- 🌍 ** Cross-Platform** - Native support for Linux, macOS, Windows with pre-built binaries
22+ - ⚡ ** IPv6 P2P Direct Connection** - Automatic peer-to-peer connection with relay fallback for optimal performance
2223- 🎯 ** Multiple Encryption Options**
2324 - ** ChaCha20-Poly1305** (Default, Recommended)
2425 - ** AES-256-GCM** (Hardware accelerated)
@@ -32,7 +33,6 @@ A high-performance VPN tunnel implementation written in Rust.
3233- [ Configuration] ( #configuration )
3334- [ Usage] ( #usage )
3435- [ Build from Source] ( #build-from-source )
35- - [ Architecture] ( #architecture )
3636- [ Security] ( #security )
3737- [ Contributing] ( #contributing )
3838
@@ -72,17 +72,17 @@ Each release includes:
7272** Linux/macOS:**
7373``` bash
7474# Download and extract (example for Linux x86_64)
75- wget https://github.com/smartethnet/rustun/releases/download/v1. 0.0/rustun-v1. 0.0-x86_64-unknown-linux-gnu.tar.gz
76- tar xzf rustun-v1. 0.0-x86_64-unknown-linux-gnu.tar.gz
77- cd rustun-v1. 0.0-x86_64-unknown-linux-gnu
75+ wget https://github.com/smartethnet/rustun/releases/download/0.0.1 /rustun-0.0.1 -x86_64-unknown-linux-gnu.tar.gz
76+ tar xzf rustun-0.0.1 -x86_64-unknown-linux-gnu.tar.gz
77+ cd rustun-0.0.1 -x86_64-unknown-linux-gnu
7878
7979# Make binaries executable
8080chmod +x server client
8181```
8282
8383** Windows:**
8484``` powershell
85- # 1. Download rustun-v1. 0.0-x86_64-pc-windows-msvc.zip from releases
85+ # 1. Download rustun-0.0.1 -x86_64-pc-windows-msvc.zip from releases
8686# 2. Extract to a directory
8787# 3. Download Wintun from https://www.wintun.net/
8888# 4. Extract wintun.dll to the same directory as client.exe
@@ -234,6 +234,10 @@ Options:
234234 Encryption method: plain, aes256:<key>, chacha20:<key>, or xor:<key>
235235 [default: chacha20:rustun]
236236
237+ --enable-p2p
238+ Enable P2P direct connection via IPv6
239+ (disabled by default, uses relay only)
240+
237241 --keepalive-interval <KEEPALIVE_INTERVAL>
238242 Keep-alive interval in seconds
239243 [default: 10]
@@ -265,6 +269,33 @@ Options:
265269./client -s SERVER:8080 -i client-001 -c plain
266270```
267271
272+ ### P2P Direct Connection
273+
274+ By default, all traffic goes through the relay server. Enable P2P for direct IPv6 connections between clients:
275+
276+ ``` bash
277+ # Enable P2P direct connection
278+ ./client -s SERVER:8080 -i client-001 --enable-p2p
279+ ```
280+
281+ ** P2P Benefits:**
282+ - 🚀 Lower latency (direct peer-to-peer)
283+ - 📉 Reduced server bandwidth usage
284+ - ⚡ Automatic fallback to relay if P2P fails
285+
286+ ** Requirements:**
287+ - Both clients must have IPv6 connectivity
288+ - Both clients must use ` --enable-p2p ` flag
289+ - UDP port 51258 must be accessible
290+
291+ ** How it works:**
292+ 1 . Clients exchange IPv6 addresses via server
293+ 2 . Keepalive packets establish direct connection
294+ 3 . Data sent via P2P when connection is active
295+ 4 . Automatic fallback to relay if P2P fails
296+
297+ For more details, see [ P2P Usage Guide] ( ./docs/P2P_USAGE.md ) .
298+
268299### Example: Multi-Tenant Setup
269300
270301#### Scenario: Two Offices (Beijing & Shanghai)
@@ -313,50 +344,6 @@ ping 10.0.2.2 # From sh-office-gw to sh-db-server
313344# Beijing cannot reach Shanghai and vice versa
314345```
315346
316- ## 🏗️ Architecture
317-
318- ### Network Topology
319-
320- ```
321- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
322- │ Client A │◄───────►│ Server │◄───────►│ Client B │
323- │ (Beijing) │ │ (Central) │ │ (Shanghai) │
324- └─────────────┘ └─────────────┘ └─────────────┘
325- │ │
326- │ Virtual IP: 10.0.1.1 Virtual IP: 10.0.2.1
327- │ │
328- ┌──▼──────────────┐ ┌───────────▼──────┐
329- │ LAN: 192.168.1.0│ │ LAN: 192.168.10.0│
330- └─────────────────┘ └──────────────────┘
331- ```
332-
333- ### Components
334-
335- - ** Server** : Central relay handling all client connections
336- - ** Client** : Edge node connecting to the server
337- - ** TUN Device** : Virtual network interface for packet tunneling
338- - ** Crypto Layer** : Encryption/decryption of all traffic
339- - ** Route Manager** : Dynamic routing table management
340-
341- ### Frame Protocol
342-
343- ```
344- Frame Header (8 bytes):
345- ┌──────────────┬─────────┬──────┬─────────────────┐
346- │ Magic (4B) │ Ver (1B)│ Type │ Payload Len │
347- │ 0x91929394 │ 0x01 │ (1B) │ (2B) │
348- └──────────────┴─────────┴──────┴─────────────────┘
349- │
350- ▼
351- Encrypted Payload
352- ```
353-
354- ** Frame Types:**
355- - ` 0x01 ` : Handshake (client authentication)
356- - ` 0x02 ` : KeepAlive (connection health check)
357- - ` 0x03 ` : Data (tunneled IP packets)
358- - ` 0x04 ` : HandshakeReply (server configuration response)
359-
360347## 🔒 Security
361348
362349### Encryption Algorithms
@@ -446,18 +433,16 @@ For cross-platform builds, see [BUILD.md](BUILD.md) for detailed instructions.
446433
447434## 🗺️ Roadmap
448435
449- - [ ] IPv6 support
450- - [ ] P2P direct connection
436+ - [x] ** IPv6 support** - ✅ Completed
437+ - [x] ** P2P direct connection** - ✅ Completed (IPv6 P2P with auto fallback)
451438- [ ] Windows service support
452439- [ ] systemd integration for Linux
453440- [ ] Web-based management dashboard
454441- [ ] Dynamic route updates without restart
455- - [ ] UDP transport support
456442- [ ] QUIC protocol support
457443- [ ] Mobile clients (iOS/Android)
458444- [ ] Docker container images
459445- [ ] Kubernetes operator
460- - [ ] Pre-built binary releases
461446- [ ] Auto-update mechanism
462447
463448## 📦 Download
0 commit comments