NewConnection returns a new NetworkingConnection with provided configuration.
(config Config)
| 31 | // NewConnection returns a new NetworkingConnection with provided |
| 32 | // configuration. |
| 33 | func NewConnection(config Config) *NetworkingConnection { |
| 34 | tr := &http.Transport{ |
| 35 | TLSClientConfig: &tls.Config{ |
| 36 | InsecureSkipVerify: config.SkipSSLValidation, |
| 37 | }, |
| 38 | Proxy: http.ProxyFromEnvironment, |
| 39 | DialContext: (&net.Dialer{ |
| 40 | KeepAlive: 30 * time.Second, |
| 41 | Timeout: config.DialTimeout, |
| 42 | }).DialContext, |
| 43 | } |
| 44 | |
| 45 | return &NetworkingConnection{ |
| 46 | HTTPClient: &http.Client{Transport: tr}, |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // Make performs the request and parses the response. |
| 51 | func (connection *NetworkingConnection) Make(request *Request, passedResponse *Response) error { |
no outgoing calls
no test coverage detected