cavaliergopher / grab

A download manager package for Go
BSD 3-Clause "New" or "Revised" License
1.39k stars 150 forks source link

[Feature] Add Socks5 Proxy support #56

Closed zquestz closed 5 years ago

zquestz commented 5 years ago

Added NewClientWithProxy which allows using Socks5 proxies from github.com/btcsuite/go-socks/socks

Also added SetDefaultClientWithProxy so that convenience functions can benefit from this.

cavaliercoder commented 5 years ago

Hey thanks for submitting this. This is a neat idea but I don't think I'll merge this PR. The reason being, that Grab is already extendable in this way - without hard coding new functions and importing new dependencies.

The simplest way to do this is:

grab.DefaultClient.HTTPClient.Transport.Dial = proxy.Dial

There are an infinite number of other possible configurations that users may want. It wouldn't make sense to make convenience functions for this and every other useful configuration. Instead, we expose Client/Transport configuration.