client.go | 8 -------- config.go | 16 +++------------- diff --git a/client.go b/client.go index 451788c55289f7f5fbc2379f2681e136c693e422..8bb1ca38a6f8defdbad2afdab0955d82a424cc49 100644 --- a/client.go +++ b/client.go @@ -10,8 +10,6 @@ "errors" "fmt" "io" "net" - "net/http" - "net/url" "strconv" "strings" "time" @@ -214,12 +212,6 @@ o := copy(cl.peerID[:], cfg.Bep20) _, err = rand.Read(cl.peerID[o:]) if err != nil { panic("error generating peer id") - } - } - - if cl.config.HTTPProxy == nil && cl.config.ProxyURL != "" { - if fixedURL, err := url.Parse(cl.config.ProxyURL); err == nil { - cl.config.HTTPProxy = http.ProxyURL(fixedURL) } } diff --git a/config.go b/config.go index 692b0751fc6b75804e5c7661c33305f8f578a4a0..ee41ba0248586bd61393cdff46aadb828a4d4ee3 100644 --- a/config.go +++ b/config.go @@ -19,8 +19,6 @@ "github.com/anacrolix/torrent/mse" "github.com/anacrolix/torrent/storage" ) -var DefaultHTTPUserAgent = "Go-Torrent/1.0" - // Probably not safe to modify this after it's given to a Client. type ClientConfig struct { // Store torrent file data in this directory unless .DefaultStorage is @@ -76,11 +74,6 @@ CryptoProvides mse.CryptoMethod // Chooses the crypto method to use when receiving connections with header obfuscation. CryptoSelector mse.CryptoSelector - // Sets usage of Socks5 Proxy. Authentication should be included in the url if needed. - // Examples: socks5://demo:demo@192.168.99.100:1080 - // http://proxy.domain.com:3128 - ProxyURL string - IPBlocklist iplist.Ranger DisableIPv6 bool `long:"disable-ipv6"` DisableIPv4 bool @@ -89,11 +82,8 @@ // Perform logging and any other behaviour that will help debug. Debug bool `help:"enable debugging"` Logger log.Logger - // HTTPProxy defines proxy for HTTP requests. - // Format: func(*Request) (*url.URL, error), - // or result of http.ProxyURL(HTTPProxy). - // By default, it is composed from ClientConfig.ProxyURL, - // if not set explicitly in ClientConfig struct + // 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) // HTTPUserAgent changes default UserAgent for HTTP requests HTTPUserAgent string @@ -150,7 +140,7 @@ } func NewDefaultClientConfig() *ClientConfig { cc := &ClientConfig{ - HTTPUserAgent: DefaultHTTPUserAgent, + HTTPUserAgent: "Go-Torrent/1.0", ExtendedHandshakeClientVersion: "go.torrent dev 20181121", Bep20: "-GT0002-", UpnpID: "anacrolix/torrent",