Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
// 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))
}