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

Method DialAgentNetConn

coderd/tailnet.go:316–334  ·  view source on GitHub ↗
(ctx context.Context, agentID uuid.UUID, network, addr string)

Source from the content-addressed store, hash-verified

314}
315
316func (s *ServerTailnet) DialAgentNetConn(ctx context.Context, agentID uuid.UUID, network, addr string) (net.Conn, error) {
317 conn, release, err := s.AgentConn(ctx, agentID)
318 if err != nil {
319 return nil, xerrors.Errorf("acquire agent conn: %w", err)
320 }
321
322 // Since we now have an open conn, be careful to close it if we error
323 // without returning it to the user.
324
325 nc, err := conn.DialContext(ctx, network, addr)
326 if err != nil {
327 release()
328 return nil, xerrors.Errorf("dial context: %w", err)
329 }
330
331 return &netConnCloser{Conn: nc, close: func() {
332 release()
333 }}, err
334}
335
336func (s *ServerTailnet) ServeHTTPDebug(w http.ResponseWriter, r *http.Request) {
337 s.conn.MagicsockServeHTTPDebug(w, r)

Callers 1

dialContextMethod · 0.95

Calls 3

AgentConnMethod · 0.95
DialContextMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected