How smolkar/wireguard_surf works
WireGuard_Surf is a small WireGuard VPN server with an HTTP API for identifying users and managing client peers. Its main workflow is to load or create server configuration, bring up a WireGuard interface, apply peer configuration, and serve client-management requests. Client creation allocates an IP and generates keys; client configuration can be returned as text or a QR code. The README also documents manual NAT setup and flags DNS and authentication as unfinished. The source excerpts are partial, so uncertain lifecycle and persistence links are omitted.
Main entry points: api.go Client management · main.go Server process · Configuration.go Key generation
Components 18
VPN server
- Server process
main.go - Server lifecycle
main.go - Peer configuration
main.go
HTTP API
- HTTP API server
api.go - User context
api.go - Client management
api.go - Client config export
api.go
Configuration
- Client records
Configuration.go - Server config file
Configuration.go - Key generation
Configuration.go
Network setup
- Client IP allocation
main.go - WireGuard interface
main.go - NAT setup
main.go
Other components
- Server operator
- VPN client
- Linux network host
- WireGuard device
- API user
Connections 20
- Server operator → Server process: starts
- Server process → Server config file: loads or creates
- Server process → Server lifecycle: starts
- Server lifecycle → WireGuard interface: brings up
- WireGuard interface → Linux network host: configures link
- Server lifecycle → Peer configuration: configures peers
- Peer configuration → WireGuard device: applies peers
- Server process → HTTP API server: starts
- API user → HTTP API server: sends requests
- HTTP API server → User context: wraps requests
- User context → Client management: dispatches
- Client management → Client records: reads or changes
- Client management → Client IP allocation: allocates address
- Client management → Key generation: creates keys
- Client management → Peer configuration: reconfigures peers
- Client management → Client config export: serves client
- Client config export → VPN client: returns config or QR
- Key generation → Client records: fills key fields
- Server operator → NAT setup: configures manually
- NAT setup → Linux network host: sets masquerading