示例#1
1
// Initialise the http.Transport for go1.7+
func (ci *ConfigInfo) initTransport(t *http.Transport) {
	t.DialContext = func(ctx context.Context, network, address string) (net.Conn, error) {
		return dialContextTimeout(ctx, network, address, ci.ConnectTimeout, ci.Timeout)
	}
	t.IdleConnTimeout = 60 * time.Second
	t.ExpectContinueTimeout = ci.ConnectTimeout
}