func oneShotProxy(proxy *gopensslproxy.ProxyHttpServer, t *testing.T) (client *http.Client, s *httptest.Server) { proxy.Verbose = true s = httptest.NewServer(proxy) fmt.Println("AAAAAAAAAAAA: ", s.URL) proxyUrl, _ := url.Parse(s.URL) tr := &http.Transport{TLSClientConfig: acceptAllCerts, Proxy: http.ProxyURL(proxyUrl)} client = &http.Client{Transport: tr} return }
// ProxyBasic will force HTTP authentication before any request to the proxy is processed func ProxyBasic(proxy *gopensslproxy.ProxyHttpServer, realm string, f func(user, passwd string) bool) { proxy.OnRequest().Do(Basic(realm, f)) proxy.OnRequest().HandleConnect(BasicConnect(realm, f)) }