| 483 | } |
| 484 | |
| 485 | func (d ConnDiags) Write(w io.Writer) { |
| 486 | _, _ = fmt.Fprintln(w, "") |
| 487 | general, client, agent := d.splitDiagnostics() |
| 488 | for _, msg := range general { |
| 489 | _, _ = fmt.Fprintln(w, msg) |
| 490 | } |
| 491 | if len(general) > 0 { |
| 492 | _, _ = fmt.Fprintln(w, "") |
| 493 | } |
| 494 | if len(client) > 0 { |
| 495 | _, _ = fmt.Fprint(w, "Possible client-side issues with direct connection:\n\n") |
| 496 | for _, msg := range client { |
| 497 | _, _ = fmt.Fprintf(w, " - %s\n\n", msg) |
| 498 | } |
| 499 | } |
| 500 | if len(agent) > 0 { |
| 501 | _, _ = fmt.Fprint(w, "Possible agent-side issues with direct connections:\n\n") |
| 502 | for _, msg := range agent { |
| 503 | _, _ = fmt.Fprintf(w, " - %s\n\n", msg) |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | func (d ConnDiags) splitDiagnostics() (general, client, agent []string) { |
| 509 | if d.AgentNetcheck != nil { |