How amnezia-vpn/amneziawg-go works
AmneziaWG is a userspace VPN daemon that adds DPI-resistant traffic obfuscation to WireGuard. The main workflow starts the daemon, creates a TUN interface and UAPI control listener, then configures and runs a device that exchanges encrypted packets over network sockets. The README documents configurable handshake junk and signature packets, message padding and headers, header protection, and timing controls. The graph includes those capabilities, plus the optional Outline stream-dialer integration. Some internal packet-stage connections are omitted because the sampled excerpts do not establish their callers.
Main entry points: device.go Device lifecycle · main.go Daemon entry · bind_std.go UDP bind · tun.go TUN interface
Components 19
Daemon runtime
- Daemon entry
main.go - Device lifecycle
device/device.go
Configuration control
- UAPI listener
ipc - UAPI configuration
device/uapi.go
Tunnel and transport
- TUN interface
tun/tun.go - Linux TUN
tun/tun_linux.go - Userspace netstack
tun/netstack/tun.go - UDP bind
conn/bind_std.go - Windows bind
conn/bind_windows.go
VPN protocol
- Obfuscation settings
device/uapi.go - Packet sending
device/send.go - Packet receiving
device/receive.go - Noise handshake
device/noise-protocol.go - Peer state
device/peer.go - Allowed IPs
device/allowedips.go
Optional integration
- Outline dialer
outline/dialer.go
Other components
- Operator
- AWG tools
- Network peers
Connections 24
- Operator → Daemon entry: starts
README.md - Daemon entry → TUN interface: creates
main.go - Daemon entry → UAPI listener: opens
main.go - Daemon entry → Device lifecycle: constructs
main.go - AWG tools → UAPI listener: configures
README.md - UAPI listener → UAPI configuration: dispatches
device/uapi.go - UAPI configuration → Device lifecycle: configures
device/uapi.go - UAPI configuration → Obfuscation settings: parses settings
device/uapi.go - Device lifecycle → UDP bind: uses
device/device.go - Device lifecycle → TUN interface: uses
device/device.go - TUN interface → Linux TUN: implemented by
tun/tun_linux.go - Device lifecycle → Packet sending: runs
- Device lifecycle → Packet receiving: runs
- Packet sending → UDP bind: sends packets
device/send.go - Packet receiving → UDP bind: receives packets
device/receive.go - Packet sending → TUN interface: reads packets
device/send.go - Device lifecycle → Noise handshake: uses handshake
- Device lifecycle → Peer state: manages
- Peer state → Allowed IPs: routes by
- Network peers → UDP bind: exchanges datagrams
- Daemon entry → Windows bind: selects on Windows
- Outline dialer → Userspace netstack: creates
outline/dialer.go - Outline dialer → Device lifecycle: configures and starts
outline/dialer.go - Outline dialer → UDP bind: selects bind
outline/dialer.go