diff options
Diffstat (limited to 'src/wscat.go')
-rw-r--r-- | src/wscat.go | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/wscat.go b/src/wscat.go index b9a17a6..6ed0aea 100644 --- a/src/wscat.go +++ b/src/wscat.go @@ -26,8 +26,6 @@ import ( "unicode/utf8" "unsafe" - "proxy" - g "gobang" ) @@ -77,12 +75,6 @@ type Dialer struct { // TLSClientConfig is ignored. NetDialTLSContext func(ctx context.Context, network, addr string) (net.Conn, error) - // Proxy specifies a function to return a proxy for a given - // Request. If the function returns a non-nil error, the - // request is aborted with the provided error. - // If Proxy is nil or returns a nil *URL, no proxy is used. - Proxy func(*http.Request) (*url.URL, error) - // TLSClientConfig specifies the TLS configuration to use with tls.Client. // If nil, the default configuration is used. // If either NetDialTLS or NetDialTLSContext are set, Dial assumes the TLS handshake @@ -150,7 +142,6 @@ func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) { // DefaultDialer is a dialer with all fields set to the default values. var DefaultDialer = &Dialer{ - Proxy: http.ProxyFromEnvironment, HandshakeTimeout: 45 * time.Second, } @@ -287,20 +278,6 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h } } - // If needed, wrap the dial function to connect through a proxy. - if d.Proxy != nil { - proxyURL, err := d.Proxy(req) - if err != nil { - return nil, nil, err - } - if proxyURL != nil { - netDial, err = proxyFromURL(proxyURL, netDial) - if err != nil { - return nil, nil, err - } - } - } - hostPort, hostNoPort := hostPortNoPort(u) trace := httptrace.ContextClientTrace(ctx) if trace != nil && trace.GetConn != nil { @@ -2310,22 +2287,6 @@ func (fn netDialerFunc) DialContext(ctx context.Context, network, addr string) ( return fn(ctx, network, addr) } -func proxyFromURL(proxyURL *url.URL, forwardDial netDialerFunc) (netDialerFunc, error) { - if proxyURL.Scheme == "http" { - return (&httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDial}).DialContext, nil - } - dialer, err := proxy.FromURL(proxyURL, forwardDial) - if err != nil { - return nil, err - } - if d, ok := dialer.(proxy.ContextDialer); ok { - return d.DialContext, nil - } - return func(ctx context.Context, net, addr string) (net.Conn, error) { - return dialer.Dial(net, addr) - }, nil -} - type httpProxyDialer struct { proxyURL *url.URL forwardDial netDialerFunc |