(hostURL *url.URL)
| 268 | } |
| 269 | |
| 270 | func defaultHTTPClient(hostURL *url.URL) (*http.Client, error) { |
| 271 | transport := &http.Transport{} |
| 272 | // Necessary to prevent long-lived processes using the |
| 273 | // client from leaking connections due to idle connections |
| 274 | // not being released. |
| 275 | // TODO: see if we can also address this from the server side, |
| 276 | // or in go-connections. |
| 277 | // see: https://github.com/moby/moby/issues/45539 |
| 278 | transport.MaxIdleConns = 6 |
| 279 | transport.IdleConnTimeout = 30 * time.Second |
| 280 | err := sockets.ConfigureTransport(transport, hostURL.Scheme, hostURL.Host) |
| 281 | if err != nil { |
| 282 | return nil, err |
| 283 | } |
| 284 | return &http.Client{ |
| 285 | Transport: transport, |
| 286 | CheckRedirect: CheckRedirect, |
| 287 | }, nil |
| 288 | } |
| 289 | |
| 290 | // Close the transport used by the client |
| 291 | func (cli *Client) Close() error { |
no outgoing calls
no test coverage detected
searching dependent graphs…