|
|
@@ -61,12 +61,16 @@ func makeTCPDialer(config *DialConfig) func(network, addr string) (net.Conn, err
|
|
|
if err != nil {
|
|
|
return nil, ContextError(err)
|
|
|
}
|
|
|
- if config.ResolvedIPCallback != nil {
|
|
|
- host, _, err := net.SplitHostPort(conn.RemoteAddr().String())
|
|
|
- if err == nil {
|
|
|
- config.ResolvedIPCallback(host)
|
|
|
- }
|
|
|
- }
|
|
|
+ // Note: when an upstream proxy is used, we don't know what IP address
|
|
|
+ // was resolved, by the proxy, for that destination.
|
|
|
+ if config.ResolvedIPCallback != nil && config.UpstreamProxyUrl == "" {
|
|
|
+ remoteAddr := conn.RemoteAddr()
|
|
|
+ if remoteAddr != nil {
|
|
|
+ host, _, err := net.SplitHostPort(conn.RemoteAddr().String())
|
|
|
+ if err == nil {
|
|
|
+ config.ResolvedIPCallback(host)
|
|
|
+ }
|
|
|
+ } }
|
|
|
return conn, nil
|
|
|
}
|
|
|
}
|