websocketTrackers websocketTrackers
activeAnnounceLimiter limiter.Instance
+ webseedHttpClient *http.Client
}
type ipStr string
cl.torrents = make(map[metainfo.Hash]*Torrent)
cl.dialRateLimiter = rate.NewLimiter(10, 10)
cl.activeAnnounceLimiter.SlotsPerKey = 2
-
cl.event.L = cl.locker()
cl.ipBlockList = cfg.IPBlocklist
+ cl.webseedHttpClient = &http.Client{
+ Transport: &http.Transport{
+ Proxy: cfg.HTTPProxy,
+ MaxConnsPerHost: 10,
+ },
+ }
}
func NewClient(cfg *ClientConfig) (cl *Client, err error) {
"errors"
"fmt"
"io"
- "net/http"
"net/url"
"sort"
"strings"
return &t.cl.config.Callbacks
}
-var WebseedHttpClient = &http.Client{
- Transport: &http.Transport{
- MaxConnsPerHost: 10,
- },
-}
-
func (t *Torrent) addWebSeed(url string) {
if t.cl.config.DisableWebseeds {
return
callbacks: t.callbacks(),
},
client: webseed.Client{
- // Consider a MaxConnsPerHost in the transport for this, possibly in a global Client.
- HttpClient: WebseedHttpClient,
+ HttpClient: t.cl.webseedHttpClient,
Url: url,
},
activeRequests: make(map[Request]webseed.Request, maxRequests),