Netcheck returns a network check report from the workspace agent.
(ctx context.Context)
| 409 | |
| 410 | // Netcheck returns a network check report from the workspace agent. |
| 411 | func (c *agentConn) Netcheck(ctx context.Context) (healthsdk.AgentNetcheckReport, error) { |
| 412 | ctx, span := tracing.StartSpan(ctx) |
| 413 | defer span.End() |
| 414 | res, err := c.apiRequest(ctx, http.MethodGet, "/api/v0/netcheck", nil) |
| 415 | if err != nil { |
| 416 | return healthsdk.AgentNetcheckReport{}, xerrors.Errorf("do request: %w", err) |
| 417 | } |
| 418 | defer res.Body.Close() |
| 419 | if res.StatusCode != http.StatusOK { |
| 420 | return healthsdk.AgentNetcheckReport{}, codersdk.ReadBodyAsError(res) |
| 421 | } |
| 422 | |
| 423 | var resp healthsdk.AgentNetcheckReport |
| 424 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 425 | } |
| 426 | |
| 427 | // DebugMagicsock makes a request to the workspace agent's magicsock debug endpoint. |
| 428 | func (c *agentConn) DebugMagicsock(ctx context.Context) ([]byte, error) { |
nothing calls this directly
no test coverage detected