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

Method director

coderd/tailnet.go:257–263  ·  view source on GitHub ↗

director makes sure agentIDKey is set on the context in the reverse proxy. This allows the transport to correctly identify which agent to dial to.

(agentID uuid.UUID, prev func(req *http.Request))

Source from the content-addressed store, hash-verified

255// director makes sure agentIDKey is set on the context in the reverse proxy.
256// This allows the transport to correctly identify which agent to dial to.
257func (*ServerTailnet) director(agentID uuid.UUID, prev func(req *http.Request)) func(req *http.Request) {
258 return func(req *http.Request) {
259 ctx := context.WithValue(req.Context(), agentIDKey{}, agentID)
260 *req = *req.WithContext(ctx)
261 prev(req)
262 }
263}
264
265func (s *ServerTailnet) dialContext(ctx context.Context, network, addr string) (net.Conn, error) {
266 agentID, ok := ctx.Value(agentIDKey{}).(uuid.UUID)

Callers 1

ReverseProxyMethod · 0.95

Calls 2

WithContextMethod · 0.80
ContextMethod · 0.65

Tested by

no test coverage detected