You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): add p2p diagnostics to ping (coder#14426)
First PR to address coder#14244.
Adds common potential reasons as to why a direct connection to the workspace agent couldn't be established to `coder ping`:
- If the Coder deployment administrator has blocked direction connections (`CODER_BLOCK_DIRECT`).
- If the client has no STUN servers within it's DERP map.
- If the client or agent appears to be behind a hard NAT, as per Tailscale `netInfo.MappingVariesByDestIP`
Also adds a warning if the client or agent has a network interface below the 'safe' MTU for tailnet. This warning is always displayed at the end of a `coder ping`.
`❗ You are connected via a DERP relay, not directly (p2p)`,
746
+
`❗ Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
747
+
},
748
+
},
749
+
{
750
+
name: "AgentInterfaceWarnings",
751
+
diags: cliui.ConnDiags{
752
+
PingP2P: true,
753
+
AgentNetcheck: &healthsdk.AgentNetcheckReport{
754
+
Interfaces: healthsdk.InterfacesReport{
755
+
BaseReport: healthsdk.BaseReport{
756
+
Warnings: []health.Message{
757
+
health.Messagef(health.CodeInterfaceSmallMTU, "network interface eth0 has MTU 1280, (less than 1378), which may cause problems with direct connections"),
758
+
},
759
+
},
760
+
},
761
+
},
762
+
},
763
+
want: []string{
764
+
`❗ Agent: network interface eth0 has MTU 1280, (less than 1378), which may cause problems with direct connections`,
765
+
`✔ You are connected directly (p2p)`,
766
+
},
767
+
},
768
+
{
769
+
name: "LocalInterfaceWarnings",
770
+
diags: cliui.ConnDiags{
771
+
PingP2P: true,
772
+
LocalInterfaces: &healthsdk.InterfacesReport{
773
+
BaseReport: healthsdk.BaseReport{
774
+
Warnings: []health.Message{
775
+
health.Messagef(health.CodeInterfaceSmallMTU, "network interface eth1 has MTU 1310, (less than 1378), which may cause problems with direct connections"),
776
+
},
777
+
},
778
+
},
779
+
},
780
+
want: []string{
781
+
`❗ Client: network interface eth1 has MTU 1310, (less than 1378), which may cause problems with direct connections`,
0 commit comments