A rule-based OpenVPN traffic splitter supporting DoH DNS proxy, rule subscriptions, dynamic route injection, DNS caching, and more.
- Project Overview
- Features
- Getting Started
- Configuration Guide
- How It Works
- Architecture
- Module Description
- FAQ
- Performance Optimization
- Security & Privacy
- How to Verify VPN Routing
- Developer Guide
- License
This project is designed to provide OpenVPN users with a high-performance and flexible rule-based traffic splitter. It prevents all traffic from going through VPN and supports subscriptions, DNS caching, CNAME resolution, and DNS pollution protection.
- Smart Traffic Routing: Automatically routes traffic based on rules
- Enhanced Privacy: Supports DoH (DNS over HTTPS) for secure DNS queries
- Improved Performance: DNS caching and optimized routing
- Easy Management: Simple configuration and rule management
- Real-time Monitoring: Comprehensive logging and status tracking
- ✅ Local DNS proxy (supports DoH / TCP / UDP)
- ✅ Custom rules and remote subscriptions (auto deduplication & merge)
- ✅ Accurate routing (adds static route via utunX)
- ✅ Automatic VPN interface detection (e.g. utun0 / utun8)
- ✅ Fixes default macOS gateway to direct network interface
- ✅ Supports recursive CNAME resolution
- ✅ Ultra-fast response via cache
- ✅ One-command startup, no complex setup
- 🔍 Domain Tracing Tool (
trace.go)- Detailed network information display
- Routing path analysis
- Automatic route fixing
- CNAME chain visualization
- 📊 Interactive Console (
ovpnctl)- Real-time log viewing
- Route testing
- Interface management
- Configuration reloading
- Go 1.18+
- macOS (supports
route,scutil, etc.) - Connected OpenVPN client (e.g. Tunnelblick)
# Clone the repository
git clone https://github.com/hex0x13h/openvpnadvanced.git
cd openvpnadvanced
# Build the project
go build -o openvpnadvanced ./cmd# Start the service
sudo ./openvpnadvancedThe tool provides an interactive command console (ovpnctl) for runtime control.
sudo ./openvpnadvanced --start| Command | Description | Example |
|---|---|---|
start |
Start core logic in background | start |
startv |
Start with real-time logs | startv |
status |
Check service status | status |
view-log |
View logs with filters | view-log info |
test |
Test domain rule match | test example.com |
rtest |
Test domain resolution | rtest example.com |
show-iface |
Show interface info | show-iface |
reload-config |
Reload configuration | reload-config |
clear |
Clear console | clear |
The trace.go tool provides detailed information about domain resolution and routing:
# Run the tracing tool
go run tools/trace.go example.com- Network Information
- Domain resolution
- IP address
- Matched rules
- CNAME chain
- Routing Information
- Current interface
- VPN interface
- Default gateway
- Route status
- Set local DNS to 127.0.0.1
- Configure DNS proxy settings in
config.ini - Add custom rules or subscribe to rule lists
- Local rules:
assets/rule.list - Remote subscriptions: Add URLs in
config.ini - Automatic updates: Configure in
config.ini
-
DNS Resolution
- Local DNS proxy handles queries
- Supports DoH for secure queries
- Caches responses for performance
-
Traffic Routing
- Analyzes domain rules
- Routes traffic through VPN or direct
- Maintains optimal routing paths
-
Interface Management
- Detects VPN interfaces
- Manages network routes
- Handles interface changes
├── cmd/ # Command-line interface
├── dnsmasq/ # DNS proxy implementation
├── vpn/ # VPN routing management
├── tools/ # Utility tools
│ └── trace.go # Domain tracing tool
├── assets/ # Configuration and rules
└── config.ini # Main configuration file
- Handles DNS queries
- Implements caching
- Supports DoH
- Manages rules
- Manages network interfaces
- Handles route injection
- Detects VPN status
- Fixes routing issues
- Domain tracing
- Route testing
- Interface inspection
- Log management
-
DNS not working
- Check local DNS settings
- Verify DNS proxy is running
- Check rule configuration
-
VPN routing issues
- Verify VPN connection
- Check interface detection
- Review route rules
-
Performance problems
- Clear DNS cache
- Optimize rules
- Check network conditions
- Implement caching
- Optimize rule matching
- Use efficient algorithms
- Minimize route changes
- Optimize interface detection
- Cache route decisions
- Support for DoH
- DNS cache protection
- Rule validation
- Secure route injection
- Interface validation
- Access control
- Use the tracing tool:
go run tools/trace.go example.com- Check routing information:
sudo ./openvpnadvanced --start
ovpnctl> rtest example.comgo build -o openvpnadvanced ./cmdgo test ./...- Fork the repository
- Create a feature branch
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.