// 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) }, }, } }
// 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}, }, } }