How johnwatsoon/wattunnel works
WatTunnel is encrypted, censorship-resistant port forwarding between Iran and Kharej. The main workflow is to configure a Kharej endpoint, create a token, configure Iran with that token and port mappings, then carry user TCP/UDP traffic over a selected carrier to Kharej and its local service. The repository also includes tunnel management, pairing and recovery, a web panel, and connection diagnostics. The graph uses README-documented behavior and shown source references; unsampled implementation details and their wiring are left out.
Main entry points: main.go Tunnel runtime · mgr Go manager · scepter_ops.go Remote operations · session.go Encrypted sessions
Components 22
Setup and management
- Go manager
cmd/wattun/mgr - Tunnel configuration
cmd/wattun/config.go - Connection tests
cmd/wattun/speedtest.go - ICMP probe
cmd/wprobe/main.go
Tunnel transport
- Tunnel runtime
cmd/wattun/main.go - Encrypted sessions
wat/session.go - Session server
wat/server.go - Carrier transports
wat/carrier_tcp.go - Carrier bonding
wat/bond.go - Stream forwarding
wat/stream.go - UDP forwarding
cmd/wattun/udp.go
Pairing and control
- Pairing credentials
cmd/wattun/pairing.go - Remote operations
cmd/wattun/scepter_ops.go - Recovery latch
cmd/wattun/latch.go - Manager cockpit
cmd/wattun/mgr/scepter_cockpit.go
Web panel
- Panel web client
cmd/wattun/panel/web/app.js - Panel API routes
cmd/wattun/panel/routes.go - Panel actions
cmd/wattun/panel/actions.go - Panel server
cmd/wattun/panel/server.go
Other components
- Tunnel operator
- Iran-side users
- Kharej local service
Connections 23
- Tunnel operator → Go manager: configures tunnels
README.md - Go manager → Tunnel configuration: writes settings
README.md - Go manager → Connection tests: runs tests
README.md - Go manager → Tunnel runtime: starts tunnel
README.md - Go manager → ICMP probe: tests ICMP
- Iran-side users → Tunnel runtime: connects through
README.md - Tunnel runtime → Encrypted sessions: creates sessions
cmd/wattun/main.go - Tunnel runtime → Session server: serves sessions
- Tunnel runtime → Carrier transports: selects carrier
README.md - Tunnel runtime → Stream forwarding: forwards TCP
cmd/wattun/main.go - Tunnel runtime → UDP forwarding: forwards UDP
cmd/wattun/main.go - Encrypted sessions → Carrier transports: uses transport
- Tunnel runtime → Carrier bonding: bonds paths
- Stream forwarding → Kharej local service: reaches local port
README.md - Tunnel operator → Panel web client: manages remotely
README.md - Panel web client → Panel server: uses panel
cmd/wattun/panel/web/app.js - Panel server → Panel API routes: routes requests
- Panel API routes → Panel actions: dispatches actions
cmd/wattun/panel/routes.go - Panel actions → Manager cockpit: manages tunnels
- Pairing credentials → Tunnel runtime: enables management channel
cmd/wattun/pairing.go - Tunnel runtime → Remote operations: serves remote operations
cmd/wattun/scepter_ops.go - Recovery latch → Remote operations: revives management
- Manager cockpit → Remote operations: issues operations