| Crates.io | twocha |
| lib.rs | twocha |
| version | 0.6.3 |
| created_at | 2025-12-08 21:37:43.601577+00 |
| updated_at | 2025-12-09 11:44:30.716645+00 |
| description | 2cha - High-performance VPN utility with IPv4/IPv6 support |
| homepage | |
| repository | https://github.com/keepinfov/2cha |
| max_upload_size | |
| id | 1974416 |
| size | 265,319 |
██████╗ ██████╗██╗ ██╗ █████╗
╚════██╗██╔════╝██║ ██║██╔══██╗
█████╔╝██║ ███████║███████║
██╔═══╝ ██║ ██╔══██║██╔══██║
███████╗╚██████╗██║ ██║██║ ██║
╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝
Minimalist VPN tool with IPv4/IPv6 dual-stack support, powered by ChaCha20-Poly1305 encryption.
# Clone
git clone https://github.com/keepinfov/2cha
cd 2cha
# Build
cargo install --path .
# Generate key (save this!)
2cha genkey > vpn.key
# Create configs
2cha init server > server.toml
2cha init client > client.toml
# Edit configs, add key, then:
# On server
sudo 2cha server -c server.toml
# On client
sudo 2cha up -c client.toml
# Check status
2cha status
# Disconnect
sudo 2cha down
# Install musl target
rustup target add x86_64-unknown-linux-musl
# Build static binary
cargo build --release --target x86_64-unknown-linux-musl
# Or use build script
./build.sh static
# For ARM64 (Raspberry Pi, etc.)
rustup target add aarch64-unknown-linux-musl
./build.sh static-arm
client.toml)[client]
server = "vpn.example.com:51820"
[tun]
name = "tun0"
mtu = 1420
[crypto]
cipher = "chacha20-poly1305"
key = "your_64_char_hex_key"
# IPv4 settings
[ipv4]
enable = true
address = "10.0.0.2"
prefix = 24
route_all = true # Full tunnel
# IPv6 settings
[ipv6]
enable = true
address = "fd00:2cha::2"
prefix = 64
route_all = true
# DNS
[dns]
servers_v4 = ["1.1.1.1", "8.8.8.8"]
servers_v6 = ["2606:4700:4700::1111"]
server.toml)[server]
listen = "0.0.0.0:51820"
max_clients = 256
[tun]
name = "tun0"
mtu = 1420
[crypto]
key = "same_key_as_clients"
[ipv4]
enable = true
address = "10.0.0.1"
prefix = 24
[ipv6]
enable = true
address = "fd00:2cha::1"
prefix = 64
[gateway]
ip_forward = true
ip6_forward = true
masquerade_v4 = true
masquerade_v6 = true
external_interface = "eth0"
| Command | Description |
|---|---|
up |
Connect to VPN |
down |
Disconnect |
status |
Show connection status |
toggle |
Toggle connection on/off |
server |
Run as VPN server |
genkey |
Generate encryption key |
init |
Create config template |
-c, --config <FILE> Config file path
-d, --daemon Run in background
-v, --verbose Detailed output
-q, --quiet Minimal output
Only VPN network traffic goes through VPN:
[ipv4]
route_all = false
routes = ["10.0.0.0/24", "192.168.100.0/24"]
ALL traffic goes through VPN:
[ipv4]
route_all = true
[ipv6]
route_all = true
[dns]
servers_v4 = ["1.1.1.1"]
2cha VPN Status
════════════════════════════════════════
Status: ● Connected
Interface: ● tun0
IPv4: 10.0.0.2/24
IPv6: fd00:2cha::2/64
Routing: ● Full tunnel (v4+v6)
Traffic: ↓ 15.24 MB / ↑ 3.12 MB
Public IP: 203.0.113.42
[performance]
socket_recv_buffer = 4194304 # 4MB for high throughput
socket_send_buffer = 4194304
batch_size = 64 # Larger batches
multi_queue = true # Multi-queue TUN
cpu_affinity = [0, 1] # Pin to CPUs
You can build it using
# dynamic version
nix build github:keepinfov/2cha
# static version (musl, supports aarch64 and x86_64)
nix build github:keepinfov/2cha#static
# or if you wanna build by your own
git clone https://github.com/keepinfov/2cha
nix develop
cargo build --release
or you can just run it using
nix run github:keepinfov/2cha
MIT