@@ -14,21 +14,37 @@ import (
14
14
"strings"
15
15
)
16
16
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
+ }
18
28
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
21
35
}
22
36
23
37
func init () {
24
38
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
26
40
})
41
+ registerDialerHttps ()
27
42
}
28
43
29
44
type httpProxyDialer struct {
30
45
proxyURL * url.URL
31
46
forwardDial func (network , addr string ) (net.Conn , error )
47
+ usesTLS bool
32
48
}
33
49
34
50
func (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)
75
91
}
76
92
return conn , nil
77
93
}
94
+
95
+ func (hpd * httpProxyDialer ) UsesTLS () bool {
96
+ return hpd .usesTLS
97
+ }
0 commit comments