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

Method Netcheck

codersdk/workspacesdk/agentconn.go:411–425  ·  view source on GitHub ↗

Netcheck returns a network check report from the workspace agent.

(ctx context.Context)

Source from the content-addressed store, hash-verified

409
410// Netcheck returns a network check report from the workspace agent.
411func (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.
428func (c *agentConn) DebugMagicsock(ctx context.Context) ([]byte, error) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected