Tunneling
dxflow provides powerful tunneling capabilities through its proxy-bridge architecture, enabling you to expose local services securely over WebSocket connections with automatic subdomain allocation.
How It Works
Proxy and Bridge Architecture
dxflow tunneling uses a hub-and-spoke model with two main components:
Proxy Hub
Central Router
- Allocates unique subdomains to bridges
- Routes incoming traffic to connected bridges
- Manages authentication and traffic limits
- Maintains connection pools for efficiency
Bridge Node
Local Gateway
- Connects to proxy hub via WebSocket
- Receives unique subdomain allocation
- Routes traffic to local upstream services
- Handles reconnection automatically
Connection Flow
Internet User → Proxy Hub → WebSocket Tunnel → Bridge Node → Local Service
Each bridge gets a unique subdomain (e.g., ab1234567890.yourhub.com
) that routes all traffic through the secure tunnel.
Setting Up Tunnels
Using the Default Hub
dxflow provides dxflow.ai
as a ready-to-use public hub:
Hub Features:
- Always available at
dxflow.ai
- Unlimited connections and traffic from hub perspective
- Automatic subdomain allocation for each bridge
- Managed infrastructure - no maintenance required
Start Your Own Proxy Hub
For private tunneling with your own infrastructure:
Private Hub Benefits:
- Full control over authentication and traffic limits
- Private infrastructure - no shared resources
- Custom domain and subdomain allocation
Connect Bridge Nodes
Connect bridge nodes to expose local services:
# Start bridge connecting to default hub (dxflow.ai)
dxflow boot up --bridge --daemon
# Bridge receives subdomain from hub
# Default: 1 connection, 10MB traffic limit
Manual Management
# List active proxies on hub
dxflow proxy list
# Create new proxy allocation
dxflow proxy create
# Remove unused proxies
dxflow proxy prune
# List bridge connections
dxflow bridge list
# Disconnect bridge temporarily
dxflow bridge disconnect <identity>
# Reconnect bridge
dxflow bridge connect <identity>
# Clean up inactive bridges
dxflow bridge prune
Identity System
Unique Identifiers
Every proxy-bridge connection uses a 12-character alphanumeric identity:
Property | Details |
---|---|
Format | 12-byte alphanumeric (e.g., ab1234567890 ) |
Usage | Subdomain allocation and traffic routing |
Generation | Automatically created during connection |
Authentication
Proxy Credentials
Auto-Generated
- Username: 6-character random nonce
- Password: 24-character random nonce
- Required for WebSocket connections
Gateway Authorization
Optional Security
- Authorization tokens in query parameters
- Prevents unauthorized subdomain allocation
- Additional security layer
Traffic Management
Connection Pooling
dxflow optimizes performance through intelligent connection pooling:
- 8-second pairing window for matching connections
- Automatic cleanup of unpaired connections
- Thread-safe operations with mutex protection
- Connection reuse to reduce overhead
Default Configuration
dxflow tunneling comes with different defaults for hubs and nodes:
dxflow.ai Hub
- Default hub:
dxflow.ai
(public) - Connection limit: Unlimited
- Traffic limit: Unlimited
- Purpose: Central routing for all users
Bridge Nodes
- Default connections: 1 bridge allowed
- Default traffic: 10MB limit
- License required: Bridge functionality needs license
- General license: Bridge feature not included
Security Features
Network Security
dxflow tunneling includes several security measures:
Upstream Validation
Private IP Only
- Bridge must connect to private IPs
- Prevents exposing public services
- Enforces local network boundaries
TLS Support
Encrypted Connections
- HTTPS gateway connections
- Proper SNI handling for subdomains
- Certificate validation for secure tunnels
Protocol Security
The hijack protocol enables efficient routing:
<identity|fingerprint>
Element | Description |
---|---|
identity | 12-byte bridge identifier |
fingerprint | UUID for connection tracking |
Performance Characteristics
Latency Comparison
Connection Type | Characteristics |
---|---|
Direct Proxy | Minimal overhead, production-ready, low latency |
Bridge Tunnel | WebSocket overhead, development/testing scenarios |
Traffic Statistics
Hub Metrics
- User traffic (incoming from internet)
- Bridge traffic (to/from bridge nodes)
- Format:
(↓ download) (↑ upload)
- Real-time bandwidth tracking
Node Metrics
- Gateway traffic (to/from hub)
- Upstream traffic (to/from local service)
- Bandwidth monitoring against limits
- Connection timestamps
Troubleshooting
Common Issues
"Proxy not available"
- Identity doesn't exist on hub
- Proxy was removed or never created
- Check proxy list on hub
"Proxy not connected"
- WebSocket connection dropped
- Network interruption occurred
- Verify bridge status and connectivity
"Bridge not allowed"
- General license doesn't include bridge feature
- Bridge functionality requires specific license
- Upgrade to bridge-enabled license (see licensing guide)
"Traffic limit exceeded"
- 10MB default limit reached on bridge
- License upgrade needed for higher limits (see licensing guide)
- Monitor traffic usage carefully
Debugging Steps
- Enable debug logging:
dxflow --log-level=debug boot up --proxy
- Monitor connection pools: Check pool sizes and timeout messages
- Track traffic stats: Use API for real-time bandwidth monitoring
- Test connectivity: Verify upstream services and WebSocket connections
Best Practices
Production Deployment
Security First
- Use HTTPS for all gateway connections
- Set appropriate traffic limitations
- Rotate credentials regularly
- Monitor traffic patterns
Performance
- Tune buffer sizes for workload
- Optimize timeout values
- Use connection pooling effectively
- Monitor statistics for bottlenecks
Reliability
- Implement retry logic for failures
- Monitor connection pool health
- Set up automated cleanup tasks
- Plan for horizontal scaling
API Integration
The tunneling system provides REST APIs for programmatic control:
Proxy Hub APIs
# List active proxies
curl http://hub/api/proxy/
# Create new proxy
curl -X POST http://hub/api/proxy/
# Remove inactive proxies
curl -X DELETE http://hub/api/proxy/prune/
Bridge Node APIs
# List bridge connections
curl http://node/api/bridge/
# Reconnect specific bridge
curl -X POST http://node/api/bridge/{identity}/connect/
# Clean up inactive bridges
curl -X DELETE http://node/api/bridge/prune/
The tunneling architecture enables secure, scalable access to distributed services while maintaining simplicity in configuration and management.