mirror of https://github.com/golang/go.git
Put net.Dialer literal back into godoc
This commit is contained in:
parent
0ac1456698
commit
948a0ed97e
|
|
@ -41,8 +41,11 @@ import (
|
|||
// as directed by the $HTTP_PROXY and $NO_PROXY (or $http_proxy and
|
||||
// $no_proxy) environment variables.
|
||||
var DefaultTransport RoundTripper = &Transport{
|
||||
Proxy: ProxyFromEnvironment,
|
||||
DialContext: defaultTransportDialContext(),
|
||||
Proxy: ProxyFromEnvironment,
|
||||
DialContext: defaultTransportDialContext(&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}),
|
||||
ForceAttemptHTTP2: true,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,6 @@ import (
|
|||
"net"
|
||||
)
|
||||
|
||||
func defaultTransportDialContext() func(context.Context, string, string) (net.Conn, error) {
|
||||
func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,8 @@ package http
|
|||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
func defaultTransportDialContext() func(context.Context, string, string) (net.Conn, error) {
|
||||
dialer := &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}
|
||||
func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
|
||||
return dialer.DialContext
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue