MCPcopy Create free account
hub / github.com/coder/coder / mitmHostsCondition

Method mitmHostsCondition

enterprise/aibridgeproxyd/reload.go:105–112  ·  view source on GitHub ↗

mitmHostsCondition returns a goproxy ReqConditionFunc that reads the MITM host set from the atomic router on every match. Using a closure instead of goproxy.ReqHostIs(...) lets Reload affect every later CONNECT without re-registering handlers.

()

Source from the content-addressed store, hash-verified

103// instead of goproxy.ReqHostIs(...) lets Reload affect every later
104// CONNECT without re-registering handlers.
105func (s *Server) mitmHostsCondition() goproxy.ReqConditionFunc {
106 return func(req *http.Request, _ *goproxy.ProxyCtx) bool {
107 if req == nil {
108 return false
109 }
110 return slices.Contains(s.loadProviderRouter().mitmHosts, strings.ToLower(req.URL.Host))
111 }
112}
113
114// buildProviderRouter constructs a router snapshot from a classified
115// provider reload. Only providers with Status ==

Callers 1

NewFunction · 0.95

Calls 2

loadProviderRouterMethod · 0.95
ContainsMethod · 0.45

Tested by

no test coverage detected