Skip to content

Routing Lifecycle

This page describes the current Connect -> Gateway route flow.

1) Connect discovers candidate gateways

Connect asks Public API for available gateways for its server:

  • GET /v1/connect/servers/{serverId}/gateways

The response includes route host hints and candidate gateway metadata.

2) Connect probes and picks the best reachable gateway

Connect probes gateway control port (CONNECT_GATEWAY_CONNECT_PORT, default 9001) and ranks candidates by latency (optionally region-preferred).

3) Connect opens tunnel and publishes route ownership

After tunnel bootstrap succeeds, Connect publishes ownership:

  • PUT /v1/connect/servers/{serverId}/gateway-route

When no gateway is reachable, Connect removes the route:

  • DELETE /v1/connect/servers/{serverId}/gateway-route

4) Gateway watcher pulls route snapshot

Watcher heartbeats and receives active routing state from Public API. It renders the current snapshot into:

  • /etc/minecraft/routes.json

5) mcproxy relays Minecraft TCP traffic

mcproxy reads routes.json and forwards Minecraft traffic on 25565 to the active tunnel/backend.

Relevant tuning knobs

  • CONNECT_GATEWAY_HEARTBEAT_SECONDS
  • CONNECT_GATEWAY_CONNECT_PORT
  • CONNECT_GATEWAY_MINECRAFT_PORT
  • CONNECT_GATEWAY_PUBLIC_HOST

No manual route editing is performed inside gateway runtime.