client.go | 3 ++- config.go | 2 ++ diff --git a/client.go b/client.go index e0aea9527a6100d4e4a55a20d275a953fca16952..a77aea84b6fe87702a0d1863592d2b19ed0899fa 100644 --- a/client.go +++ b/client.go @@ -203,7 +203,8 @@ cl.event.L = cl.locker() cl.ipBlockList = cfg.IPBlocklist cl.httpClient = &http.Client{ Transport: &http.Transport{ - Proxy: cfg.HTTPProxy, + Proxy: cfg.HTTPProxy, + DialContext: cfg.HTTPDialContext, // I think this value was observed from some webseeds. It seems reasonable to extend it // to other uses of HTTP from the client. MaxConnsPerHost: 10, diff --git a/config.go b/config.go index 11e70d6830f45dd616f75e774ba732f1c889ee5a..1189872ee9e26435c60259b1fe22a7ff767ebd8a 100644 --- a/config.go +++ b/config.go @@ -91,6 +91,8 @@ // Defines proxy for HTTP requests, such as for trackers. It's commonly set from the result of // "net/http".ProxyURL(HTTPProxy). HTTPProxy func(*http.Request) (*url.URL, error) + // Defines DialContext func to use for HTTP requests, such as for fetching metainfo and webtorrent seeds + HTTPDialContext func(ctx context.Context, network, addr string) (net.Conn, error) // Defines DialContext func to use for HTTP tracker announcements TrackerDialContext func(ctx context.Context, network, addr string) (net.Conn, error) // Defines ListenPacket func to use for UDP tracker announcements