Documentation
¶
Overview ¶
Package nethttp exposes helpers that adapt decodo configuration and leases into proxy values accepted by the Go standard library net/http package.
Proxy URL ¶
Convert a decodo Config into a *url.URL:
proxyURL, err := nethttpadapter.ProxyURL(config)
ProxyFunc ¶
Obtain a net/http-compatible proxy function for use with http.Transport:
proxyFunc, err := nethttpadapter.ProxyFunc(config)
transport := &http.Transport{Proxy: proxyFunc}
SOCKS5 Support ¶
net/http does not natively support SOCKS5. ProxyURLSOCKS5 returns a *url.URL suitable for use with a SOCKS5-capable dialer such as golang.org/x/net/proxy:
socks5URL, err := nethttpadapter.ProxyURLSOCKS5(config)
Then configure your transport's Dial field with the SOCKS5 dialer.
Index ¶
- func ProxyFunc(config decodo.Config) (func(*http.Request) (*url.URL, error), error)
- func ProxyFuncSOCKS5(config decodo.Config) (*url.URL, error)
- func ProxyURL(config decodo.Config) (*url.URL, error)
- func ProxyURLFromLease(lease decodo.Lease) (*url.URL, error)
- func ProxyURLSOCKS5(config decodo.Config) (*url.URL, error)
- func ProxyURLSOCKS5FromLease(lease decodo.Lease) (*url.URL, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProxyFuncSOCKS5 ¶ added in v0.3.0
ProxyFuncSOCKS5 returns a SOCKS5 proxy URL function for net/http. Note: net/http does not natively support SOCKS5. This returns the URL for use with a SOCKS5-capable dialer (e.g., golang.org/x/net/proxy).
func ProxyURLFromLease ¶
ProxyURLFromLease parses the proxy URL stored in a lease.
func ProxyURLSOCKS5 ¶ added in v0.3.0
ProxyURLSOCKS5 converts a Decodo config into a SOCKS5 proxy URL. SOCKS5 always uses gate.decodo.com:7000 - targeting is done via username parameters.
Types ¶
This section is empty.