How pkok1099/wpmulti-rs works
wpmulti is a userspace multi-tunnel WireGuard daemon that exposes SOCKS5 and HTTP/HTTPS proxies. Its main workflow loads and validates tunnel and daemon configuration, manages tunnel lifecycle and listeners, routes proxy requests through a tunnel-backed network stack, and provides administration through a REST API and TUI. The graph also includes DNS, health, and CLI capabilities. Relationships are limited to those shown in the README or source index; unsampled subsystems are represented by their exact tree paths.
Main entry points: mod.rs Tunnel manager · app.rs TUI monitor · listener.rs Proxy listeners · stack.rs Virtual IP stack
Components 26
Configuration
- Config loading
src/config/mod.rs - WireGuard parser
src/config/wg_conf.rs - Daemon settings
src/config/toml_config.rs
Tunnel runtime
- Tunnel manager
src/core/mod.rs - Tunnel registry
src/core/registry.rs - Tunnel lifecycle
src/core/lifecycle.rs - Health monitoring
src/core/health.rs
Proxy networking
- Proxy listeners
src/core/listener.rs - Tunnel selection
src/core/router.rs - Proxy connector
src/proxy/router.rs - SOCKS5 proxy
src/proxy/socks5.rs - HTTP proxy
src/proxy/http.rs - Virtual IP stack
src/netstack/stack.rs - WireGuard bridge
src/netstack/bridge.rs - Tunnel DNS
src/netstack/dns.rs - Virtual streams
src/netstack/stream.rs
Administration
- Admin API server
src/api/server.rs - Admin endpoints
src/api/routes.rs - Prometheus metrics
src/api/metrics.rs - TUI monitor
src/tui/app.rs - TUI display
src/tui/ui.rs - TUI config editor
src/tui/config_editor.rs - Log display
src/tui/logs.rs
Operations
- CLI commands
src/cli/commands.rs
Other components
- Operator or client
- WireGuard configs
Connections 31
- Operator or client → CLI commands: runs commands
src/cli/commands.rs - WireGuard configs → Config loading: loads tunnel files
src/config/mod.rs - Config loading → WireGuard parser: parses WireGuard
src/config/mod.rs - CLI commands → Config loading: loads configs
src/cli/commands.rs - CLI commands → Daemon settings: reads settings
src/cli/commands.rs - CLI commands → Tunnel manager: starts daemon
src/cli/commands.rs - Tunnel manager → Tunnel registry: manages entries
src/core/mod.rs - Tunnel manager → Tunnel lifecycle: coordinates lifecycle
src/core/mod.rs - Tunnel manager → Health monitoring: probes tunnels
src/core/mod.rs - Tunnel manager → Proxy listeners: supervises listeners
src/core/mod.rs - Proxy listeners → Proxy connector: configures routing
src/core/listener.rs - Proxy listeners → SOCKS5 proxy: serves SOCKS5
- Proxy listeners → HTTP proxy: serves HTTP
- SOCKS5 proxy → Proxy connector: connects requests
src/proxy/socks5.rs - HTTP proxy → Proxy connector: connects requests
src/proxy/http.rs - Proxy connector → Tunnel selection: selects tunnel
src/proxy/router.rs - Tunnel selection → Tunnel registry: checks candidates
src/core/router.rs - Tunnel selection → Tunnel lifecycle: activates tunnel
src/core/router.rs - Tunnel lifecycle → Virtual IP stack: creates stack
src/core/lifecycle.rs - Virtual IP stack → WireGuard bridge: bridges packets
src/netstack/stack.rs - Virtual IP stack → Tunnel DNS: resolves domains
src/netstack/stack.rs - Virtual IP stack → Virtual streams: provides streams
src/netstack/stack.rs - Operator or client → Admin API server: calls admin API
README.md - Admin API server → Admin endpoints: dispatches requests
src/api/server.rs - Admin endpoints → Tunnel manager: controls tunnels
src/api/routes.rs - Admin endpoints → Prometheus metrics: serves metrics
src/api/routes.rs - Operator or client → TUI monitor: opens dashboard
README.md - TUI monitor → Admin API server: queries API
README.md - TUI monitor → TUI display: renders dashboard
src/tui/app.rs - TUI monitor → TUI config editor: edits settings
src/tui/app.rs - TUI monitor → Log display: displays logs
src/tui/app.rs