Skip to content

feat(cli): add aws check to ping p2p diagnostics #14450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add back hyphens
  • Loading branch information
ethanndickson committed Aug 29, 2024
commit 55cda77ff43fbaf45b05ea482e76fea7808c6252
24 changes: 12 additions & 12 deletions cli/cliui/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,13 @@ func (d ConnDiags) Write(w io.Writer) {
if len(client) > 0 {
_, _ = fmt.Fprint(w, "Possible client-side issues with direct connection:\n\n")
for _, msg := range client {
_, _ = fmt.Fprintf(w, " %s\n\n", msg)
_, _ = fmt.Fprintf(w, " - %s\n\n", msg)
}
}
if len(agent) > 0 {
_, _ = fmt.Fprint(w, "Possible agent-side issues with direct connections:\n\n")
for _, msg := range agent {
_, _ = fmt.Fprintf(w, " %s\n\n", msg)
_, _ = fmt.Fprintf(w, " - %s\n\n", msg)
}
}
}
Expand Down Expand Up @@ -423,30 +423,30 @@ func (d ConnDiags) splitDiagnostics() (general, client, agent []string) {
}

if !d.ConnInfo.DERPMap.HasSTUN() {
general = append(general, "The DERP map is not configured to use STUN")
general = append(general, "The DERP map is not configured to use STUN")
} else if d.LocalNetInfo != nil && !d.LocalNetInfo.UDP {
client = append(client, "Client could not connect to STUN over UDP")
client = append(client, "Client could not connect to STUN over UDP")
}

if d.LocalNetInfo != nil && d.LocalNetInfo.MappingVariesByDestIP.EqualBool(true) {
client = append(client, "Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers")
client = append(client, "Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers")
}

if d.AgentNetcheck != nil && d.AgentNetcheck.NetInfo != nil {
if d.AgentNetcheck.NetInfo.MappingVariesByDestIP.EqualBool(true) {
agent = append(agent, "Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers")
agent = append(agent, "Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers")
}
if !d.AgentNetcheck.NetInfo.UDP {
agent = append(agent, "Agent could not connect to STUN over UDP")
agent = append(agent, "Agent could not connect to STUN over UDP")
}
}

if d.ClientIPIsAWS {
client = append(client, "Client IP address is within an AWS range (AWS uses hard NAT)")
if true {
client = append(client, "Client IP address is within an AWS range (AWS uses hard NAT)")
}

if d.AgentIPIsAWS {
agent = append(agent, "Agent IP address is within an AWS range (AWS uses hard NAT)")
if true {
agent = append(agent, "Agent IP address is within an AWS range (AWS uses hard NAT)")
}
return general, client, agent
}
Expand All @@ -457,5 +457,5 @@ func formatHealthMessage(msg health.Message) string {
}
r := []rune(strings.Replace(msg.Message, ", which may cause problems with direct connections", "", -1))
out := string(append([]rune{unicode.ToUpper(r[0])}, r[1:]...))
return fmt.Sprintf("%s, which may degrade the quality of direct connections", out)
return fmt.Sprintf("%s, which may degrade the quality of direct connections", out)
}
18 changes: 9 additions & 9 deletions cli/cliui/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`The DERP map is not configured to use STUN`,
`The DERP map is not configured to use STUN`,
},
},
{
Expand All @@ -744,7 +744,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Client could not connect to STUN over UDP`,
`Client could not connect to STUN over UDP`,
},
},
{
Expand All @@ -771,7 +771,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Agent could not connect to STUN over UDP`,
`Agent could not connect to STUN over UDP`,
},
},
{
Expand All @@ -786,7 +786,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
`Client is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
},
},
{
Expand All @@ -803,7 +803,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
`Agent is potentially behind a hard NAT, as multiple endpoints were retrieved from different STUN servers`,
},
},
{
Expand All @@ -824,8 +824,8 @@ func TestConnDiagnostics(t *testing.T) {
},
},
want: []string{
`❗ Network interface eth0 has MTU 1280, (less than 1378), which may degrade the quality of direct connections`,
`✔ You are connected directly (p2p)`,
`Network interface eth0 has MTU 1280, (less than 1378), which may degrade the quality of direct connections`,
},
},
{
Expand All @@ -844,8 +844,8 @@ func TestConnDiagnostics(t *testing.T) {
},
},
want: []string{
`❗ Network interface eth1 has MTU 1310, (less than 1378), which may degrade the quality of direct connections`,
`✔ You are connected directly (p2p)`,
`Network interface eth1 has MTU 1310, (less than 1378), which may degrade the quality of direct connections`,
},
},
{
Expand All @@ -859,7 +859,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Client IP address is within an AWS range (AWS uses hard NAT)`,
`Client IP address is within an AWS range (AWS uses hard NAT)`,
},
},
{
Expand All @@ -873,7 +873,7 @@ func TestConnDiagnostics(t *testing.T) {
},
want: []string{
`❗ You are connected via a DERP relay, not directly (p2p)`,
`Agent IP address is within an AWS range (AWS uses hard NAT)`,
`Agent IP address is within an AWS range (AWS uses hard NAT)`,
},
},
}
Expand Down
Loading