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.
()
| 103 | // instead of goproxy.ReqHostIs(...) lets Reload affect every later |
| 104 | // CONNECT without re-registering handlers. |
| 105 | func (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 == |
no test coverage detected