MCPcopy Create free account
hub / github.com/Code-Hex/pget / newDownloadClient

Function newDownloadClient

client.go:11–24  ·  view source on GitHub ↗
(maxIdleConnsPerHost int)

Source from the content-addressed store, hash-verified

9)
10
11func newDownloadClient(maxIdleConnsPerHost int) *http.Client {
12 tr := http.DefaultTransport.(*http.Transport).Clone()
13 dialer := newDialRateLimiter(&net.Dialer{
14 Timeout: 30 * time.Second,
15 KeepAlive: 30 * time.Second,
16 })
17 tr.DialContext = dialer.DialContext
18 tr.MaxIdleConns = 0 // no limit
19 tr.MaxIdleConnsPerHost = maxIdleConnsPerHost
20 tr.DisableCompression = true
21 return &http.Client{
22 Transport: tr,
23 }
24}
25
26func newClient(client *http.Client) *http.Client {
27 if client == nil {

Callers 2

RunMethod · 0.85
TestPgetFunction · 0.85

Calls 1

newDialRateLimiterFunction · 0.85

Tested by 1

TestPgetFunction · 0.68