Quick Start
1. Get your API secret
Go to your project’s Settings page and copy the API secret. In your terminal, export it as an environment variable:2. Run the diagnostics client
Clone the iroh-n0des repo and run thenet_diagnostics example:
3. Run a diagnostic from the dashboard
Go to your project’s Endpoints page. You should see the example client listed as an online endpoint. Click Run Diagnostics to generate a report. The report appears on the Net Diagnostics page and includes:- NAT Type — No NAT, Endpoint-Independent, Endpoint-Dependent, or Unknown
- UDP Connectivity — IPv4 and IPv6 status with public addresses
- NAT Mapping — whether mapping varies by destination (symmetric NAT detection)
- Direct Addresses — local addresses the endpoint is listening on
- Port Mapping — UPnP, PCP, and NAT-PMP availability
- Relay Latencies — per-relay IPv4, IPv6, and HTTPS round-trip times
- Captive Portal — detection of captive portal interference
Understanding the Report
NAT Types
| NAT Type | What it means | Connection quality |
|---|---|---|
| No NAT | Local address matches public address | Direct connections work with correct firewall config |
| Endpoint-Independent | One outbound UDP packet opens a port for any sender | Holepunching works reliably |
| Endpoint-Dependent | Only the specific destination can reply (symmetric NAT) | Connections will primarily use relays |
| Unknown | NAT behavior could not be determined | Check UDP connectivity |
Connectivity Summary
The report includes a color-coded connectivity summary:- Green — UDP works and NAT is favorable. Direct connections should work.
- Orange — Endpoint-Dependent NAT. Direct connections may be difficult; traffic will often be relayed.
- Red — No UDP connectivity. Traffic will be relayed.
Integrating Net Diagnostics Into Your App
To add net diagnostics support to your own iroh application, you need to:- Connect to n0des with an
iroh_n0des::Client - Grant the
NetDiagnosticsCap::GetAnycapability to n0des so it can request diagnostics from your endpoint - Run a
ClientHostso n0des can dial back into your endpoint
Cargo.toml:
How It Works
When you click Run Diagnostics in the dashboard, n0des dials back into your endpoint using the capability token your app granted. YourClientHost receives the request, runs the diagnostics locally (probing UDP connectivity, NAT behavior, relay latency, and port mapping), and returns the report to n0des for display.
The capability grant (NetDiagnosticsCap::GetAny) authorizes n0des to request diagnostics from your endpoint. Without this grant, the Run Diagnostics button will be disabled in the dashboard even if the endpoint is online.
Requirements
- The
net_diagnosticsandclient_hostcargo features must be enabled oniroh-n0des - The
N0DES_API_SECRETenvironment variable must be set before your app starts - The
ClientHostmust be registered on theRouterwithCLIENT_HOST_ALPNso n0des can reach it