Solution Architect with 6 years of experience • Creator of STUNMESH-go and EZIO Project • Expertise in major public cloud networking services and on-prem datacenter networking design • Specialized in Cloud Network, OpenStack, Kubernetes, SD-WAN, and open-source • Extensive speaking experience at international conferences 2
solve? • STUN implementation in different platform (Linux, MacOS, FreeBSD) • Compatibility with WireGuard kernel module • Plugin system without self-hosted service • Minimizing binary size for embedded systems • Next Step for STUNMESH-go 3
behind Firewall and NAT • Make true Peer-to-Peer WireGuard connection • No self-hosted server needed • Cross-Platform and Cross-Architecture support • Inspired by FOSDEM 2018 - BulletinBoard DHT and wireguard-p2p by Manuel Schoelling ◦ Thanks to Manuel & FOSDEM • GPL v2 or Later • https://github.com/tjjh89017/stunmesh-go/ Github Link 5
to proxy the traffic and do the STUN separately • Other solutions still need Self-hosted server for connection exchange • Without forking and embedding Wireguard-go ◦ to share the same port socket for STUN implementation (what Tailscale did) 6
STUN STUN Server Listen on / send&recv packet Remote Peer Proxy connect to remote peer It might be another Proxy Config wg remote endpoint with 127.0.0.1:<port B> thru Proxy Proxy does the “Port Translation” for WG for easy STUN procedure Forward packet port B Info Exchange 7
to proxy the traffic and do the STUN separately ◦ Remove the Proxy by re-using the same port as WireGuard used for STUN ◦ WireGuard connect to the remote peer directly • Self-hosted server for connection exchange ◦ Implement Plugin to re-use the existing public service as Key-Value storage • Without forking and embedding Wireguard-go ◦ Different STUN implementation details will be covered later. 8
Server Listen on / send&recv packet directly to remote peer Remote Peer Config wg remote endpoint with true remote peer endpoint Info Exchange Get remote peer endpoint from plugin system 10
with self-construct STUN request • Raw Sockets ◦ Send and Receive STUN packets. • cBPF (SO_ATTACH_FILTER) ◦ Capture only STUN packets (using the STUN magic cookie/header). • All other non-STUN packets flow to the WireGuard as normal, ensuring zero disruption to the VPN traffic while we correctly discover the public endpoint. 11
would not receive any packets from Raw Sockets, need to rely on BPF /dev/bpf for low-level packet capture. • Raw Sockets ◦ Allow the STUNMESH-go to send and receive raw packets directly on the network interface. • BPF (/dev/bpf) ◦ Monitor all interfaces and capture only STUN packets for a short period (using the STUN magic cookie/header) 12
relies on OS feature to hijack the same UDP port as WireGuard • Control Plane Only: ◦ Only need to configure remote endpoint on demand, without proxying the data plane ◦ The highly optimized WireGuard kernel module still handles all the high-speed VPN traffic • Compatible with WireGuard Kernel Module and WireGuard-go userspace implementation • Without proxies or embedded WireGuard-go to implement complex feature set 13
STUN server only tells your device its public IP and Port • The Missing Link: ◦ You still do not know the remote peer's public endpoint. • Why not self-hosted exchange platform? ◦ If I have a self-hosted exchange platform, why not just make it as a VPN hub? • Exchange Platform without self-hosted: ◦ This should be a secure, external mechanism for both peers to Upload and Retrieve each others public endpoints. 14
◦ The system utilizes existing Public Key-Value services (like Cloudflare DNS or custom APIs) • Secure Exchange ◦ Encrypted by Curve25519 Sealedbox before being stored; This process reuses the WireGuard peer key pair, simplifying key management. • Concise and Direct ◦ Any Key-Value storage can fit this model. ◦ Implement a custom plugin to define your own serialization, enabling integration with any custom storage solution. 15
Store ◦ Cloudflare's DNS TXT records can act as the simple key-value storage backend. • Key Mapping ◦ The unique identifier is mapped to the subdomain name(e.g. [key].<subdomain>.<zone>) • Value Mapping ◦ The Encrypted Public Endpoint (IP:Port) is stored in the TXT record field value. • This uses existing, highly available public infrastructure for secure peer exchange. 19