Discovery & transports
crocbot has two related problems that look similar on the surface:- Operator remote control: clients controlling a gateway running elsewhere.
- Node connectivity: nodes finding and connecting to a gateway.
Terms
- Gateway: a single long-running process that owns state and runs channels.
- Gateway WS (control plane): WebSocket endpoint on
127.0.0.1:18789by default; can be bound to LAN/tailnet viagateway.bind. - Direct WS transport: a LAN/tailnet-facing Gateway WS endpoint (no SSH).
- SSH transport (fallback): remote control by forwarding
127.0.0.1:18789over SSH. - Legacy TCP bridge (deprecated/removed): older node transport (see Bridge protocol); no longer advertised for discovery.
Discovery inputs (how clients learn where the gateway is)
1) Tailnet DNS-SD (recommended)
crocbot supports wide‑area DNS‑SD over Tailnet for discovery. This replaces local mDNS/Bonjour, which has been removed from the Telegram-only build. High‑level flow:- Run a DNS server on the gateway host (reachable over Tailnet).
- Publish DNS‑SD records for
_crocbot-gw._tcpundercrocbot.internal.. - Configure Tailscale split DNS so clients resolve
crocbot.internal.via that DNS server.
2) Manual direct WS (LAN/tailnet)
If you already know the gateway host, connect directly over LAN or Tailnet:ws://<host>:18789(or whatever port you configured)- Use
gateway.auth.tokenorgateway.auth.passwordfor non-loopback binds.
3) SSH tunnel (fallback)
When direct access is not possible, use SSH to forward the loopback port:Transport selection (client policy)
Recommended client behavior:- If a direct endpoint is configured and reachable, use it.
- Else, if Tailnet DNS-SD discovery is enabled, offer a one-tap “Use this gateway”.
- Else, fall back to SSH.
Authentication
The gateway enforces auth on all non-loopback connections:- Token auth (
gateway.auth.token) or password auth (gateway.auth.password) - Scope/ACLs enforced by the gateway
- Rate limits and per-method guards still apply
Responsibilities by component
- Gateway: advertises discovery beacons, owns auth, and hosts the WS endpoint.
- Clients: store direct endpoints, connect with auth, and use SSH as fallback.
- Nodes: connect to the paired gateway endpoint configured by the operator.
