Skywire Visor¶
The Visor is the primary Skywire network participant. It manages transports, routes packets, and runs applications.
Identity¶
A visor is identified by a secp256k1 key pair. The public key serves as the visor's network address. The secret key is used for signing discovery entries, transport settlements, and Noise protocol handshakes.
Initialization¶
The visor initializes subsystems in a dependency-ordered module chain:
- Event broadcaster — internal event pub/sub
- DMSG HTTP — bootstrap DMSG client for service communication
- DMSG client — primary DMSG connection to relay servers
- STUN client — NAT type detection
- Transport clients — STCPR, SUDPH, STCP network clients
- DMSG Ctrl — DMSG control protocol
- DMSG HTTP log server — health, node-info, services on DMSG port 80
- Transport manager — transport lifecycle, TPD registration
- Address resolver — AR client for STCPR/SUDPH address binding
- Router — routing table, packet dispatch, route setup
- App launcher — application lifecycle management
- Hypervisor — web UI (if enabled)
- Public autoconnect — automatic STCPR/SUDPH transports to public visors
- Self-probe — periodic DMSG listener reachability check
- Skynet port forwarding — register localhost ports for skynet/DMSG access
Optional embedded subsystems:
- Embedded RSN — route setup node with separate DMSG identity
- Embedded TPS — transport setup node with separate DMSG identity
- Embedded dmsgweb — .dmsg resolving SOCKS5 proxy
- Embedded skynetweb — .skynet resolving SOCKS5 proxy
DMSG Port 80 (Log Server)¶
Every visor serves an HTTP API on DMSG port 80:
| Endpoint | Auth | Description |
|---|---|---|
/health |
None | Visor health status (version, uptime, transport counts) |
/services |
None | List of registered skynet/DMSG ports |
/node-info |
Survey whitelist | System survey data |
/node-info/checksum |
Survey whitelist | SHA256 of survey data |
/visor.log |
Survey whitelist | Visor debug log file |
/debug/pprof/* |
Survey whitelist | Go runtime profiling |
/transport_logs/* |
Survey whitelist | Transport bandwidth CSV files |
/stats/transports |
Survey whitelist | Live snapshot of all current transports (id, edges, type, current bw/latency) |
/stats/transports/history |
Survey whitelist | Daily transport rollups; query since, until, optional id filter |
/stats/uptime |
Survey whitelist | Three-tier uptime bitmaps (process, dmsg, skynet), 288-char per day; query since |
/stats/services |
Survey whitelist | Per-service uptime bitmaps in the same format; query since |
/ |
None | Landing page with links to available endpoints |
The landing page shows forwarded port links when ShowOnLanding is true.
If port 80 has a forwarded port entry with proxy_addr, unmatched routes are reverse-proxied to the local address (replaces the landing page).
Skynet Port Forwarding¶
Visors can forward local TCP ports over the network. Port forwarding metadata is stored in local/forwarded_ports.json:
{
"80": {
"port": 80,
"local_port": 3000,
"label": "My Website",
"description": "Custom web application",
"show_on_landing": true,
"skynet": true,
"dmsg": true,
"proxy_addr": "127.0.0.1:3000",
"whitelist": ["02abc..."]
}
}
Access control on port 80:
- /health, /services — open to all
- /node-info, /visor.log, /debug/pprof — survey whitelist
- Website (catch-all) — forwarded port whitelist (empty = allow all)
Configuration¶
The visor config (skywire-config.json) is generated by skywire cli config gen and sourced from SKYENV variables. Key sections:
| Section | Description |
|---|---|
dmsg |
DMSG client: discovery URL, server list, session count, protocol |
transport |
Transport layer: TPD URL, AR URL, autoconnect, ports, TPS PKs |
routing |
Router: RSN PKs, route finder URL, min hops |
launcher |
App launcher: service discovery URL, app list, bin path |
hypervisor |
Hypervisor UI: enable, auth, HTTP addr, TLS |
survey_whitelist |
PKs allowed to access survey/pprof endpoints |
hypervisors |
Remote hypervisor PKs to connect to |
See config-gen.md for config generation and config-runtime.md for runtime changes.
RPC Interface¶
The visor serves a Go net/rpc interface on cli_addr (default localhost:3435). The CLI communicates with the visor exclusively through this RPC interface.
Key RPC method categories: - Visor info — PK, version, uptime, health - Transport management — add, remove, list, autoconnect toggle - Route management — list rules, set min hops, RSN stats - App management — start, stop, list, configure args - DMSG diagnostics — porter stats/reset, reconnect, set sessions - Skynet — port forwarding, skynet HTTP requests - Hypervisor — enable, disable, add remote HV - Config — show running config, reward address
Close Stack¶
The visor maintains a close stack of cleanup functions. On shutdown, functions are called in reverse order (LIFO) with a configurable timeout (shutdown_timeout, default 10s). This ensures orderly teardown: apps stop before transports, transports close before DMSG sessions.