Fix transport port
This commit is contained in:
@@ -39,7 +39,7 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
|||||||
dialer := &net.Dialer{}
|
dialer := &net.Dialer{}
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
host, _, err := net.SplitHostPort(addr)
|
host, port, err := net.SplitHostPort(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -57,13 +57,12 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ipv6 == nil { // No IPv6 address found, fallback to default
|
if ipv6 == nil { // No IPv6 address found, fallback to default
|
||||||
r.log.Warnf("No IPv6 address found for %s, falling back to default", host)
|
addr = net.JoinHostPort(host, port)
|
||||||
addr = net.JoinHostPort(host, req.URL.Port())
|
|
||||||
} else {
|
} else {
|
||||||
addr = net.JoinHostPort(ipv6.String(), req.URL.Port())
|
addr = net.JoinHostPort(ipv6.String(), port)
|
||||||
}
|
}
|
||||||
} else if ipv6 != nil && host == req.URL.Hostname() {
|
} else if ipv6 != nil && host == req.URL.Hostname() {
|
||||||
addr = net.JoinHostPort(ipv6.String(), req.URL.Port())
|
addr = net.JoinHostPort(ipv6.String(), port)
|
||||||
}
|
}
|
||||||
return dialer.DialContext(ctx, network, addr)
|
return dialer.DialContext(ctx, network, addr)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user