diff --git a/proxy/per_host_test.go b/proxy/per_host_test.go index 0447eb427a..8c310a0b48 100644 --- a/proxy/per_host_test.go +++ b/proxy/per_host_test.go @@ -21,6 +21,11 @@ func (r *recordingProxy) Dial(network, addr string) (net.Conn, error) { return nil, errors.New("recordingProxy") } +func (r *recordingProxy) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { + r.addrs = append(r.addrs, addr) + return nil, errors.New("recordingProxy") +} + func TestPerHost(t *testing.T) { expectedDef := []string{ "example.com:123", diff --git a/proxy/proxy.go b/proxy/proxy.go index 9ff4b9a776..69b0d6876f 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -7,6 +7,7 @@ package proxy // import "golang.org/x/net/proxy" import ( + "context" "errors" "net" "net/url" @@ -19,6 +20,7 @@ import ( type Dialer interface { // Dial connects to the given address via the proxy. Dial(network, addr string) (c net.Conn, err error) + DialContext(ctx context.Context, network, address string) (net.Conn, error) } // Auth contains authentication parameters that specific Dialers may require.