Repository navigation
Network Topology
🌐 English · 简体中文
This page documents Trizano's end-to-end network architecture from clients to Nodes, the transport and authentication used on each hop, the Hub reverse proxy and WebSocket bridges, the desktop local proxy, and cross-Node delegation data paths. It is aimed at operators planning firewall rules, troubleshooting connectivity, or understanding internal traffic flow.
All clients talk exclusively to an Entry Hub; Nodes never open listening network ports. Whether a Node runs locally, over SSH, inside WSL, natively on Windows, or behind NAT as a Reverse Node, every Hub-to-Node link carries the same HTTP/2 (h2c) channel underneath.
flowchart LR
subgraph Clients["Clients"]
Web["Browser (Web UI)"]
Android["Android Client"]
Desktop["Desktop App (Local Proxy 127.0.0.1:47801)"]
end
Proxy["HTTPS Reverse Proxy / Tunnel (Tailscale Serve · Cloudflare Tunnel · Caddy)"]
Hub["Entry Hub (trizano-carbon): 127.0.0.1:47900 · admin.sock"]
subgraph Nodes["Nodes (trizano-h3)"]
Local["Local Node: attach ⇄ run/node.sock"]
SSH["SSH Node (Linux/macOS): ssh stdio ⇄ attach"]
WSL["WSL Distro Node: [ssh] wsl.exe --exec attach"]
Win["Windows Native Node: ssh cmd/PS ⇄ attach"]
Rev["Reverse Node (behind NAT): outbound WS /nodes-connect"]
end
Web -->|"HTTPS / WSS"| Proxy
Android -->|"HTTPS / WSS"| Proxy
Desktop -->|"HTTPS / WSS"| Proxy
Proxy -->|"HTTP/1.1 · h2c · WS"| Hub
Hub -->|"Local stdio → h2c"| Local
Hub -->|"OpenSSH stdio → h2c"| SSH
Hub -->|"wsl.exe stdio → h2c"| WSL
Hub -->|"OpenSSH stdio → h2c"| Win
Rev -->|"WS → mutual TLS 1.3 → h2c"| Hub
Connections split into client-to-Hub access and five Node access modes. Below is the initiator, underlying transport, and authentication mechanism for each link.
Initiated by the client. External traffic terminates TLS at Tailscale Serve, Cloudflare Tunnel, or Caddy and forwards to 127.0.0.1:47900; local access can connect directly to http://localhost:47900. Unary RPCs and server streams use Connect (over HTTP/1.1 or h2c), while bidirectional streams (terminal, preview, browser) use WebSockets.
-
Authentication: Browsers sign in with WebAuthn passkeys and send either the
trizano_sessioncookie (HttpOnly; SameSite=Strict) orAuthorization: Bearer. Android and desktop clients authenticate by signing with a local P-256 device key, pin the Hub's public key during pairing, and verifyAuthService.Hellobefore sending antt1.ticket to an Entry for the first time in a process. See Security Model for the full flow.
Initiated by the Hub (LocalDialer, server/hub/nodes/dial.go). The Hub spawns trizano-h3 attach, which connects to ~/.trizano/node/run/node.sock (starting the daemon detached if it is not already running) and bridges its stdin/stdout to that Unix socket. The Hub runs an h2c client over the stdio pipe.
-
Authentication: Relies on OS filesystem permissions—the Node directory is
0700andrun/node.sockis0600, restricting access to the current OS user. Connections over this socket carry the owner-channel marker.
Initiated by the Hub (RemoteDialer, server/hub/nodes/remote.go). The Hub invokes the system ssh -T client (on Unix with ControlMaster=auto and ControlPersist=10m, sockets under <data>/ssh/%C; see server/hub/sshx/sshx.go) to run <remote-dir>/bin/<build>/trizano-h3 attach --root <remote-dir>/node on the remote host. The Hub wraps the ssh child process stdin/stdout as a net.Conn and runs h2c over it.
-
Authentication: Reuses OpenSSH keys,
ssh-agent,~/.ssh/config, and remote filesystem permissions. -
Keepalive and reconnection: The h2c connection sends a ping after 10 s idle and drops if no reply arrives within 5 s (or on write timeout). On disconnect, the Hub closes that host's
ControlMasterand reconnects with exponential backoff from 1 s to 30 s (backoff resets once the connection stays healthy for 1 minute; seeserver/hub/nodes/node.go).
Initiated by the Hub using the same RemoteDialer stdio + h2c pipeline:
- When the Hub runs on Windows locally, it spawns
wsl.exe -d <distro> --exec <remote-dir>/bin/<build>/trizano-h3 attach --root <remote-dir>/node(withWSL_UTF8=1). - For WSL on a remote Windows host, it runs
ssh <host> wsl.exe -d <distro> --exec …. Authentication relies on local OS permissions or OpenSSH.
Initiated by the Hub (server/hub/nodes/windows.go). Installs and upgrades transfer binaries via sftp -b -; at runtime, the Hub executes .\.trizano\bin\<build>\trizano-h3.exe attach --root .\.trizano\node over OpenSSH (supporting cmd.exe, Windows PowerShell, and PowerShell 7) and runs h2c over stdio. Authentication relies on OpenSSH.
Initiated outbound by the Node daemon (ReverseConnector, server/node/connect.go and server/hub/enrollment.go), traversing NAT, reverse proxies, and Cloudflare Tunnel:
-
Challenge handshake: The Node calls the public RPC
NodeEnrollmentService.StartNodeConnectwith itsnode_id, a 32-byteclient_nonce, and its locally held Roster statements. The Hub returns a one-timeconnect_id, a 32-bytechallenge(valid for 30 s), and a proof signed by the Hub's private key. -
Signature verification and WebSocket upgrade: After verifying the Hub's signature against its pinned Entry public key, the Node signs a
trizano-connect-node-v2message bound to the Hub's public key and sendsGET /nodes-connectwithX-Trizano-Connect-IdandX-Trizano-Node-Signature. The Hub atomically consumes the challenge, verifies the Node's signature, and upgrades the connection to a standard WebSocket. -
Inner mutual TLS 1.3 + h2c: Inside the WebSocket binary frames, both sides establish mutual TLS 1.3 pinned to their long-term P-256 public keys (ALPN
trizano-node-h2, 15 s handshake timeout). Inside that TLS tunnel, the Node serves h2c and the Hub'sReverseDialeracts as the h2c client for all Node RPCs. -
Keepalive: The Hub's h2c layer keeps its 10 s idle ping / 5 s timeout, and the Node additionally sends a
ws.Pingevery 30 s (10 s timeout) to stay well below proxy idle cutoffs such as Cloudflare's ~100 s timeout.
Rather than forwarding Node RPCs method by method, the Hub routes /nodes/{node}/<procedure> uniformly to the target Node in server/hub/nodes/registry.go.
Clients construct a Connect transport per Node with base URL /nodes/{node}. When a request arrives, the Hub looks up the online Node for {node}, strips the /nodes/{node} prefix, and proxies the request verbatim over that Node's h2c connection without decoding payloads. Plain HTTP endpoints on the Node (/attachments uploads, /raw files, /media image previews) use the same prefix.
At the proxy boundary, the Hub rejects client access to internal and sensitive system procedures (403), strips Authorization and Cookie headers before forwarding, and enforces isolation headers on responses. See Security Model.
Browsers (and Android/desktop clients speaking standard WebSockets) cannot initiate Connect HTTP/2 bidirectional streams directly. The Hub intercepts three procedure paths under /nodes/{node}/ when Upgrade: websocket is present and bridges them to the Node's h2c bidirectional streams:
Procedure path (under /nodes/{node}) |
Message types | Purpose | Source |
|---|---|---|---|
/trizano.node.v1.TerminalService/AttachTerminal |
AttachTerminalRequest / AttachTerminalResponse
|
Interactive I/O and resize events for PTY terminals and native agent TUIs | server/hub/nodes/terminal.go |
/trizano.node.v1.PreviewService/Dial |
DialRequest / DialResponse
|
Tunnels TCP byte streams from remote 127.0.0.1:<port> dev servers to the same local port on the client, including close_write half-close |
server/hub/nodes/preview.go |
/trizano.node.v1.BrowserService/AttachTab |
AttachTabRequest / AttachTabResponse
|
Frame streaming and mouse/keyboard/touch input for the Node's managed headless browser | server/hub/nodes/browser.go |
All three bridges follow the same conventions:
-
Origin checks and framing: Only origins matching the request
Hostor the Hub's--originlist are allowed. The default 32 KiB read limit is removed (SetReadLimit(-1)). Each binary WebSocket frame holds one raw protobuf message with no extra framing. -
Close codes:
1000normal close;1003invalid protobuf frame;4400(invalid argument / precondition, such as an unlistening port),4401(unauthenticated),4403(permission denied), and4404(terminal or Node not found) signal non-retryable errors so the client stops reconnecting; other transport or transient failures close with1011.
Each client maintains a single server-streaming RPC to the Hub: trizano.hub.v1.EventService/Watch, carrying its Entry cursor and per-Node {boot, seq} cursors. The Hub buffers only Entry-level events (Node online/offline, pairings, enrollments, Roster changes) and opens one node.v1.EventService/Watch stream to each online Node, wrapping incoming events as node_event messages and emitting a heartbeat every 10 s when idle. See Event Sync for cursor resume, replay windows, and tiered catch-up.
The desktop app (desktop-go/internal/proxy/proxy.go, upstream.go) embeds the same web frontend and serves it from a local loopback HTTP server loaded by the WebView:
-
Port strategy: Prefers
127.0.0.1:47801so the WebView keeps a stable origin forlocalStoragepreferences. If47801is busy, it falls back to an ephemeral port rather than failing to launch. -
Window isolation: Every request's
Hostmust match the proxy's own listen address, and anyOriginheader must matchhttp://127.0.0.1:<port>, or the proxy returns403—blocking DNS rebinding and cross-site requests. -
Three responsibilities:
- Serves the embedded static web assets.
- Exposes
/_desktop/*control endpoints (mode switching, standalone embedded Hub lifecycle, device-key signing, native notifications and badges, local preview port forwarding), all requiring the per-launch randomX-Trizano-Desktop-Secretheader. - Reverse-proxies
/trizano.*and/nodes/*(including the three WebSocket bridges) to the active Entry, injects the locally storedtt1.ticket, stripsSet-CookieandX-Trizano-Tokenfrom responses (saving renewed tickets locally), and handlesHelloverification and multi-Entry failover.
The desktop app also bundles a preview port forwarder (desktop-go/internal/forward): opening a remote dev-server preview binds the exact same 127.0.0.1:<port> locally (failing rather than remapping if occupied, so CORS and OAuth redirect URLs remain consistent), tunneling each local TCP connection over a PreviewService/Dial WebSocket to the Hub.
An agent Session can delegate subtasks to an agent on another machine through the injected CLI or built-in MCP server. Traffic traverses the Node's private orchestration socket, the control bridge (SystemService.OpenControlBridge) between Node and Entry, and the Hub's bridge dispatcher (server/node/orch_http.go, server/node/bridge.go, server/hub/orch.go):
sequenceDiagram
participant Agent as "Source Node Agent Process"
participant SrcNode as "Source Node (trizano-h3)"
participant Hub as "Entry Hub (trizano-carbon)"
participant DstNode as "Target Node (trizano-h3)"
Note over SrcNode,Hub: Hub opens SystemService.OpenControlBridge bidi stream when Node connects
Agent->>SrcNode: POST /internal/orch/{method} (via orch/s.sock + Bearer HMAC token)
SrcNode->>SrcNode: Verify HMAC token (session ID + hop) and MaxCrossNodeHops (1)
SrcNode->>Hub: Send OpenControlBridgeResponse {call_id, method, payload}
Note over SrcNode: With multiple Entries, tries by most recent hello; fails over on Unavailable
Hub->>Hub: handleBridgeCall routes method and enforces hop limit
Hub->>DstNode: Invoke Connect RPC over target Node h2c (CreateSession / SendMessage / WatchSession, etc.)
DstNode-->>Hub: RPC response
Hub-->>SrcNode: Send BridgeReply {call_id, payload / error} on control bridge
SrcNode-->>Agent: Return JSON response
If the target Node is temporarily absent from the current Entry's registry (for example while reconnecting), the Hub's bridgeNodeClient translates NotFound into a retryable Unavailable, letting the source Node try another Entry's control bridge or keeping watch deliveries within their retry window instead of assuming the target disappeared permanently. See Multi-Agent Orchestration for the delegation protocol, watch callbacks, and permission mapping.
All default TCP ports and Unix sockets used by Trizano at runtime:
| Address / Path | Process | Binding | Notes |
|---|---|---|---|
127.0.0.1:47900 |
trizano-carbon (Hub) |
TCP loopback | Default Hub web UI and API port; configurable with --listen (server/cmd/trizano-carbon/main.go) |
127.0.0.1:47910 |
Desktop standalone embedded Hub | TCP loopback (optional 0.0.0.0) |
Default port for desktop standalone mode; configurable in settings, increments automatically if busy (desktop-go/internal/store/store.go) |
127.0.0.1:47801 |
Desktop local proxy | TCP loopback | Default WebView proxy port; falls back to a random port if busy (desktop-go/internal/desktop/desktop.go) |
127.0.0.1:5733 |
Vite dev server | TCP loopback | Development only (make dev-web); proxies /trizano.hub.v1. and /nodes/ to 47900 (web/vite.config.ts) |
127.0.0.1:<port> |
Desktop / Android preview forwarder | TCP loopback | Bound on demand to match the remote dev server port, tunneled via PreviewService/Dial
|
~/.trizano/hub/admin.sock |
trizano-carbon (Hub) |
Unix socket | Owner admin channel inside the 0700 data directory; serves DeviceService and NodeService (server/hub/hub.go) |
~/.trizano/hub/ssh/%C |
OpenSSH client | Unix socket | SSH ControlMaster multiplexing sockets; not created on Windows (server/hub/sshx/sshx.go) |
~/.trizano/node/run/node.sock |
trizano-h3 |
Unix socket (0600) |
Node owner channel (h2c) for attach, stop, and admin; Shutdown is accepted only here (server/node/daemon.go) |
~/.trizano/node/orch/s.sock |
trizano-h3 |
Unix socket (0600) |
Agent orchestration channel (h2c); serves only POST /internal/orch/{method} for sandboxed agents (server/node/daemon.go) |
~/.trizano/node/run/tmux.sock |
tmux (managed by Node) |
Unix socket | Dedicated socket for persistent terminal sessions when tmux is available (server/node/node.go) |
English
Getting Started
Deployment & Networking
Architecture & Nodes
Agents
Clients & Development
Project & Community
中文文档
新手指引
部署与网络
架构与节点
智能体
客户端与开发
项目与社区