DebugMagicsock makes a request to the workspace agent's magicsock debug endpoint.
(ctx context.Context)
| 426 | |
| 427 | // DebugMagicsock makes a request to the workspace agent's magicsock debug endpoint. |
| 428 | func (c *agentConn) DebugMagicsock(ctx context.Context) ([]byte, error) { |
| 429 | ctx, span := tracing.StartSpan(ctx) |
| 430 | defer span.End() |
| 431 | res, err := c.apiRequest(ctx, http.MethodGet, "/debug/magicsock", nil) |
| 432 | if err != nil { |
| 433 | return nil, xerrors.Errorf("do request: %w", err) |
| 434 | } |
| 435 | if res.StatusCode != http.StatusOK { |
| 436 | return nil, codersdk.ReadBodyAsError(res) |
| 437 | } |
| 438 | defer res.Body.Close() |
| 439 | bs, err := io.ReadAll(res.Body) |
| 440 | if err != nil { |
| 441 | return nil, xerrors.Errorf("read response body: %w", err) |
| 442 | } |
| 443 | return bs, nil |
| 444 | } |
| 445 | |
| 446 | // DebugManifest returns the agent's in-memory manifest. Unfortunately this must |
| 447 | // be returns as a []byte to avoid an import cycle. |
nothing calls this directly
no test coverage detected