@@ -14,21 +14,37 @@ import (
1414 "strings"
1515)
1616
17- type netDialerFunc func (network , addr string ) (net.Conn , error )
17+ // proxyDialerEx extends the generated proxy_Dialer
18+ type proxyDialerEx interface {
19+ proxy_Dialer
20+ // UsesTLS indicates whether we expect to dial to a TLS proxy
21+ UsesTLS () bool
22+ }
23+
24+ type netDialerFunc struct {
25+ fn func (network , addr string ) (net.Conn , error )
26+ usesTLS bool
27+ }
1828
19- func (fn netDialerFunc ) Dial (network , addr string ) (net.Conn , error ) {
20- return fn (network , addr )
29+ func (ndf * netDialerFunc ) Dial (network , addr string ) (net.Conn , error ) {
30+ return ndf .fn (network , addr )
31+ }
32+
33+ func (ndf * netDialerFunc ) UsesTLS () bool {
34+ return ndf .usesTLS
2135}
2236
2337func init () {
2438 proxy_RegisterDialerType ("http" , func (proxyURL * url.URL , forwardDialer proxy_Dialer ) (proxy_Dialer , error ) {
25- return & httpProxyDialer {proxyURL : proxyURL , forwardDial : forwardDialer .Dial }, nil
39+ return & httpProxyDialer {proxyURL : proxyURL , forwardDial : forwardDialer .Dial , usesTLS : false }, nil
2640 })
41+ registerDialerHttps ()
2742}
2843
2944type httpProxyDialer struct {
3045 proxyURL * url.URL
3146 forwardDial func (network , addr string ) (net.Conn , error )
47+ usesTLS bool
3248}
3349
3450func (hpd * httpProxyDialer ) Dial (network string , addr string ) (net.Conn , error ) {
@@ -75,3 +91,7 @@ func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error)
7591 }
7692 return conn , nil
7793}
94+
95+ func (hpd * httpProxyDialer ) UsesTLS () bool {
96+ return hpd .usesTLS
97+ }
0 commit comments