Warning
This project is currently under active development and testing.
This software is for TESTING AND EDUCATIONAL PURPOSES ONLY.
Do not use in production environments or for any critical operations.
Experimental VPN playground focused on tunneling, encryption, and TLS/HTTPS masking. This codebase is not production-ready; use it only for learning and testing.
NebulaVPN implements a secure proxy tunnel with the following architecture:
- SOCKS5 Client - Local proxy that accepts connections from applications
- Encryption Layer - Encrypts all traffic using strong ciphers (AES-256-GCM or ChaCha20-Poly1305)
- TLS Transport - Wraps encrypted traffic in TLS with optional HTTPS masking
- VPN Server - Receives encrypted traffic, decrypts it, and forwards to target destinations
Application → SOCKS5 Client → Encryption → TLS/HTTPS Mask → VPN Server → Decryption → Target Internet
-
Client Setup
- Starts local SOCKS5 proxy on configured port (default: 1080)
- Connects to VPN server using TLS with certificate verification
- Optional HTTPS masking disguises traffic as legitimate HTTPS requests
-
Connection Handling
- Application connects to local SOCKS5 proxy
- Client validates SOCKS5 protocol and extracts target address
- Target address is encrypted with PBKDF2-derived keys and random salts
-
Traffic Encryption
- Each packet gets unique 32-byte salt for forward secrecy
- Uses 100,000 PBKDF2 iterations for key derivation
- Supports AES-256-GCM and ChaCha20-Poly1305 ciphers
- 12-byte nonces ensure cryptographic security
-
TLS Transport Layer
- Enforces TLS 1.3 only with hardened defaults
- Optional HTTP masking sends fake HTTP requests to disguise traffic
- Randomized User-Agents and HTTP methods for better obfuscation
-
Server Processing
- Validates client certificates and optional IP whitelists
- Decrypts packets using extracted salts and derived keys
- Forwards traffic to actual destinations with timeout protection
- Implements connection limits and rate limiting
- Strong Encryption: PBKDF2 key derivation with per-packet random salts
- Perfect Forward Secrecy: Compromise of one packet doesn't affect others
- TLS Protection: All inter-server communication encrypted with modern TLS
- Traffic Obfuscation: Optional HTTPS masking to bypass deep packet inspection
- Access Control: Server-side IP whitelisting and connection limits
- Input Validation: Comprehensive validation of all addresses and protocols
- Buffer Pooling: Reuses buffers to reduce garbage collection overhead
- Concurrent Handling: Efficient goroutine management with context cancellation
- Timeout Management: Configurable timeouts prevent resource exhaustion
- Memory Efficiency: Optimized packet structures and copying strategies
- SOCKS5-style client/server pipeline with encrypted tunnel
- Pluggable encryptors:
aes-256-gcm,chacha20-poly1305 - TLS wrapper with optional HTTPS masking (fake HTTP handshake)
- Connection limits and IP filtering on server side
- Comprehensive configuration with security defaults
- Structured logging and monitoring capabilities
- Install Go 1.20+.
cd nebulavpn- Run tests:
go test ./... - Copy
config.yaml.exampletoconfig.yamland adjust values for local testing.
Start Server:
./server -config config.yamlStart Client:
./client -config config.yamlConfigure Application:
Set your application to use SOCKS5 proxy at 127.0.0.1:1080
server:
max_connections: 1000 # Maximum concurrent connections
timeout_seconds: 30 # Connection timeout
allowed_ips: # Optional IP whitelist
- "192.168.1.100"client:
timeout_seconds: 10 # Connection timeout
retry_attempts: 3 # Connection retry attempts
tls_skip_verify: false # Certificate verificationcrypto:
method: "chacha20-poly1305" # or "aes-256-gcm"
password: "strong-password" # Minimum 8 charactershttp_mask:
enabled: true
domain: "cloudflare.com" # Disguise as legitimate HTTPS
user_agents:
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64)..."Use these settings to run stricter test environments with mTLS, certificate rotation, and observability.
server:
tls:
cert_path: "server.crt"
key_path: "server.key"
ca_path: "ca.crt"
require_client_cert: true
rotation_interval_seconds: 300
client:
tls_skip_verify: false
tls:
ca_path: "ca.crt"
cert_path: "client.crt"
key_path: "client.key"
server_name: "your-server.com"observability:
enabled: true
address: "127.0.0.1:9090"
health_path: "/healthz"
metrics_path: "/metrics"Quick checks:
curl -sSf http://127.0.0.1:9090/healthzcurl -s http://127.0.0.1:9090/metrics
server:
max_connections: 1000
rate_limit:
requests_per_second: 200
burst: 400
resource_limits:
backpressure_queue: 256
max_workers: 128
read_buffer_bytes: 32768
write_buffer_bytes: 32768
max_packet_bytes: 65536
handshake_protection:
fail_threshold: 5
block_duration_seconds: 120Suggested tuning approach:
- Start with defaults above.
- Increase
max_workersandbackpressure_queueonly after measuring CPU saturation. - Keep
max_packet_bytesclose to expected workload to reduce memory pressure. - Tune
handshake_protectionconservatively to avoid accidental lockouts of legitimate clients. - Keep
tls_skip_verify: falseexcept for temporary local diagnostics.
- Work in progress; APIs and behavior can change without notice.
- Intended only for experimentation and internal testing, not for protecting real traffic.
- Comprehensive test coverage with security validation
- Performance optimizations for high-throughput scenarios
- Production-like hardening roadmap: see
ROADMAP_PRODUCTION.md
Issues and PRs are welcome. Please keep in mind the experimental nature of the project when proposing changes.
- Follow Go best practices and security coding standards
- Add comprehensive tests for new features
- Update documentation for protocol changes
- Ensure backward compatibility when possible
This is an experimental project for educational purposes. When using or modifying:
- Never use in production - This code is not security-audited
- Understand the protocol - Each component should be studied separately
- Test thoroughly - Use the provided test suite and add more tests
- Monitor connections - Log and monitor all connections in testing
- Keep keys secure - Use strong, unique passwords for testing
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Application │ │ SOCKS5 Client │ │ VPN Server │
│ │────│ │────│ │
│ 127.0.0.1:1080│ │ Encryption │ │ :443 (TLS) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
│
┌─────────────────┐
│ Target Internet │
│ │
└─────────────────┘
MIT (see LICENSE).