MCPcopy Index your code
hub / github.com/coder/coder / DebugMagicsock

Method DebugMagicsock

codersdk/workspacesdk/agentconn.go:428–444  ·  view source on GitHub ↗

DebugMagicsock makes a request to the workspace agent's magicsock debug endpoint.

(ctx context.Context)

Source from the content-addressed store, hash-verified

426
427// DebugMagicsock makes a request to the workspace agent's magicsock debug endpoint.
428func (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.

Callers

nothing calls this directly

Calls 6

apiRequestMethod · 0.95
StartSpanFunction · 0.92
ReadBodyAsErrorFunction · 0.92
CloseMethod · 0.65
ErrorfMethod · 0.45
ReadAllMethod · 0.45

Tested by

no test coverage detected