Example #1
0
// New http.Client with timeouts.
func NewClient(timeout *net2.Timeout) *http.Client {
	if timeout == nil {
		timeout = net2.DefaultTimeout
	}
	return &http.Client{
		Transport: &http.Transport{
			Dial: func(network, addr string) (net.Conn, error) {
				return net2.Dial(network, addr, timeout)
			},
		},
	}
}
Example #2
0
// New http.Client with timeouts by skipping SSL certificate verification.
func NewClientInsecure(timeout *net2.Timeout) *http.Client {
	if timeout == nil {
		timeout = net2.DefaultTimeout
	}
	return &http.Client{
		Transport: &http.Transport{
			Dial: func(network, addr string) (net.Conn, error) {
				return net2.Dial(network, addr, timeout)
			},
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
	}
}