Bridge Discovery & Metrics

Server-to-server bridge exit-server discovery, forced re-discovery, cached exit-server listing, and live relay performance metrics on OrbMesh bridge nodes.

Overview

A bridge (entry) server does not hard-code its exit servers. Instead it runs a discovery service that periodically pulls the current set of healthy exit servers from OrbNET, caches them, and uses that cache to resolve the exit_server_id passed to /bridge/connect. These endpoints let you inspect discovery state, force an immediate refresh, list the cached exit servers, and read live relay metrics.

Available on Bridge Nodes Only

Discovery endpoints are registered only when both bridge mode and discovery are enabled on a server (bridge.enabled and bridge.discovery_enabled). The discovery service runs automatically on a configurable interval, defaulting to 5 minutes.


Discovery Status

Returns the current state of the bridge discovery service: whether it is enabled, its polling interval, when it last ran, how many exit servers it discovered and currently has cached, and the last error if discovery failed.

GET/bridge/discovery/status

Get the bridge discovery service state, interval, and cache counts

Authentication:No Auth Required

Code Examples

curl -X GET https://198.51.100.1:8443/bridge/discovery/status

Response

200Bridge discovery status
{
  "enabled": true,
  "interval": "5m0s",
  "last_discovery": "2026-02-08T14:25:00Z",
  "discovered_count": 18,
  "cached_count": 22,
  "current_server_id": "srv_eu_de_01"
}

Response Fields

FieldTypeDescription
enabledbooleanWhether discovery is enabled on this bridge node
intervalstringDiscovery polling interval (Go duration, e.g. 5m0s)
last_discoverystringISO 8601 timestamp of the most recent discovery run
last_errorstringError message from the last failed discovery run. Omitted when discovery is healthy.
discovered_countintegerNumber of exit servers found in the last successful discovery
cached_countintegerTotal exit servers currently in the cache (includes statically configured servers)
current_server_idstringThis bridge node's own server ID

Force Discovery

Triggers an immediate discovery run instead of waiting for the next interval. Useful after provisioning a new exit server so the bridge can route to it right away. Returns the refreshed status.

GET/bridge/discovery/force

Force an immediate exit-server discovery run and return updated status

Authentication:No Auth Required

Code Examples

curl -X GET https://198.51.100.1:8443/bridge/discovery/force

Response

200Discovery forced successfully
{
  "success": true,
  "status": {
    "enabled": true,
    "interval": "5m0s",
    "last_discovery": "2026-02-08T14:33:10Z",
    "discovered_count": 19,
    "cached_count": 23,
    "current_server_id": "srv_eu_de_01"
  }
}
200Discovery run failed
{
  "success": false,
  "error": "failed to reach OrbNET backend: context deadline exceeded"
}

List Cached Exit Servers

Returns the bridge node's cached set of exit servers -- the candidates it can relay to. Each entry includes connection details and per-protocol ports.

GET/bridge/discovery/servers

List the bridge node's cached exit servers and their connection details

Authentication:No Auth Required

Code Examples

curl -X GET https://198.51.100.1:8443/bridge/discovery/servers

Response

200Cached exit servers
{
  "count": 2,
  "servers": [
    {
      "id": "srv_us_ny_02",
      "name": "US New York 02",
      "address": "203.0.113.50:8443",
      "https_port": "8443",
      "vless_port": 10086,
      "wg_port": 51820,
      "ssh_port": 2222,
      "protocols": ["wireguard", "vless", "orbconnect", "ssh"],
      "priority": 10,
      "enabled": true
    },
    {
      "id": "srv_us_la_01",
      "name": "US Los Angeles 01",
      "address": "203.0.113.51:8443",
      "https_port": "8443",
      "vless_port": 10086,
      "wg_port": 51820,
      "ssh_port": 2222,
      "protocols": ["wireguard", "vless", "orbconnect", "ssh"],
      "priority": 20,
      "enabled": true
    }
  ]
}

Response Fields

FieldTypeDescription
countintegerNumber of cached exit servers
servers[].idstringExit server identifier. Use this as exit_server_id in /bridge/connect.
servers[].namestringHuman-readable server name
servers[].addressstringExit server HTTPS API address in host:port form
servers[].https_portstringHTTPS API port (default 8443)
servers[].vless_portintegerVLESS port used for bridge mode (default 10086)
servers[].wg_portintegerWireGuard port (default 51820)
servers[].ssh_portintegerSSH port for bridge mode (default 2222)
servers[].protocolsstring[]Protocols the exit server supports
servers[].priorityintegerSelection priority; lower is preferred
servers[].enabledbooleanWhether the exit server is currently usable

Bridge Metrics

Returns a detailed snapshot of bridge relay performance: session counts, byte and packet totals, tunnel statistics, latency, and per-exit-server breakdowns. This complements the lighter-weight /bridge/health endpoint with full metrics for dashboards and capacity planning.

GET/bridge/metrics

Get a detailed snapshot of bridge relay performance metrics

Authentication:No Auth Required

Code Examples

curl -X GET https://198.51.100.1:8443/bridge/metrics

Response

200Bridge relay metrics snapshot
{
  "total_sessions": 12834,
  "active_sessions": 47,
  "failed_sessions": 213,
  "total_bytes_sent": 184329472000,
  "total_bytes_received": 612847104000,
  "total_packets_sent": 142500000,
  "total_packets_received": 488200000,
  "active_tunnels": 94,
  "tunnel_created": 9241,
  "tunnel_reused": 3593,
  "tunnel_failed": 88,
  "avg_latency_ms": 23.4,
  "max_latency_ms": 142.7,
  "min_latency_ms": 8.1,
  "exit_server_stats": {
    "srv_us_ny_02": {
      "server_id": "srv_us_ny_02",
      "active_sessions": 31,
      "total_sessions": 8420,
      "bytes_sent": 120000000000,
      "bytes_received": 410000000000,
      "avg_latency_ms": 21.8,
      "failed_connections": 42,
      "last_used": "2026-02-08T14:32:51Z"
    }
  },
  "start_time": "2026-02-05T09:00:00Z",
  "last_activity": "2026-02-08T14:32:51Z"
}

Key Response Fields

FieldTypeDescription
total_sessions / active_sessions / failed_sessionsintegerLifetime, current, and failed bridge session counts
total_bytes_sent / total_bytes_receivedintegerTotal bytes relayed in each direction since startup
total_packets_sent / total_packets_receivedintegerTotal packets relayed in each direction
active_tunnelsintegerCurrently open entry-to-exit tunnels
tunnel_created / tunnel_reused / tunnel_failedintegerExit-tunnel lifecycle counters (tunnels are pooled and reused across sessions)
avg_latency_ms / max_latency_ms / min_latency_msnumberRelay latency statistics in milliseconds
exit_server_statsobjectPer-exit-server metrics keyed by exit server ID
start_time / last_activitystringISO 8601 service start and last-activity timestamps

Health vs. Metrics

Use /bridge/health for a quick load-balancer probe (status, active session count, average latency). Use /bridge/metrics for full observability -- byte/packet counters, tunnel pooling efficiency, and per-exit-server breakdowns.