We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client := &http.Client{ Transport: &http.Transport{ Dial: (&net.Dialer{ Timeout: 20 * time.Second, KeepAlive: 20 * time.Second, }).Dial, TLSHandshakeTimeout: 10 * time.Second, }, Timeout: 30 * time.Second, }
How can I set these timeouts using the DNS cache example?
client := &http.Client{ Transport: &http.Transport { MaxIdleConnsPerHost: 64, Dial: func(network string, address string) (net.Conn, error) { separator := strings.LastIndex(address, ":") ip, _ := dnscache.FetchString(address[:separator]) return net.Dial("tcp", ip + address[separator:]) }, TLSHandshakeTimeout: 10 * time.Second, } Timeout: 30 * time.Second, }
Do I need to create my own Dailer so I can set properties net.Dailer has?
net.Dailer
type Dialer struct { net.Dialer } func (d *Dailer) Dial(network string, address string) (net.Conn, error) { separator := strings.LastIndex(address, ":") ip, _ := dnscache.FetchString(address[:separator]) return net.Dial("tcp", ip + address[separator:]) }
The text was updated successfully, but these errors were encountered:
var netTransport = &http.Transport{ Dial: func(network string, address string) (net.Conn, error) { separator := strings.LastIndex(address, ":") ip, _ := t.dnsCache.FetchOneString(address[:separator]) dialer := net.Dialer{ Timeout: t.dial_timeout, DualStack: true, KeepAlive: 30 * time.Second, Resolver: &net.Resolver{ PreferGo: false, }, } return dialer.Dial("tcp", ip + address[separator:]) }, TLSHandshakeTimeout: t.tls_handshake, DisableCompression: true, IdleConnTimeout: 30 * time.Second, ResponseHeaderTimeout: t.header_timeout, MaxResponseHeaderBytes: 4096, MaxIdleConns: t.max_idle, MaxIdleConnsPerHost: t.max_idle_per_host, DisableKeepAlives:t.disable_keepalive, }
Sorry, something went wrong.
No branches or pull requests
How can I set these timeouts using the DNS cache example?
Do I need to create my own Dailer so I can set properties
net.Dailer
has?The text was updated successfully, but these errors were encountered: