aboutsummaryrefslogtreecommitdiff
path: root/fasthttpproxy
diff options
context:
space:
mode:
authorGravatar kiyon <kiyonlin@163.com> 2021-03-06 00:38:59 +0800
committerGravatar GitHub <noreply@github.com> 2021-03-05 17:38:59 +0100
commitf40ea7eb40ad517f7268ba78ff1c4e3b9f62fbde (patch)
tree751b1c498b8c1aa11f50538d4c848771e616a4de /fasthttpproxy
parentAdd DisableHeaderNamesNormalizing to PipelineClient (#991) (diff)
downloadfasthttp-f40ea7eb40ad517f7268ba78ff1c4e3b9f62fbde.tar.gz
fasthttp-f40ea7eb40ad517f7268ba78ff1c4e3b9f62fbde.tar.bz2
fasthttp-f40ea7eb40ad517f7268ba78ff1c4e3b9f62fbde.zip
Improve socks proxy (#990)
* Improve documentation about DelClientCookie which related with #951. * use proxy.FromURL to support auth
Diffstat (limited to 'fasthttpproxy')
-rw-r--r--fasthttpproxy/socks5.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/fasthttpproxy/socks5.go b/fasthttpproxy/socks5.go
index 5752704..b3339a4 100644
--- a/fasthttpproxy/socks5.go
+++ b/fasthttpproxy/socks5.go
@@ -2,6 +2,7 @@ package fasthttpproxy
import (
"net"
+ "net/url"
"github.com/valyala/fasthttp"
"golang.org/x/net/proxy"
@@ -15,7 +16,14 @@ import (
// Dial: fasthttpproxy.FasthttpSocksDialer("localhost:9050"),
// }
func FasthttpSocksDialer(proxyAddr string) fasthttp.DialFunc {
- dialer, err := proxy.SOCKS5("tcp", proxyAddr, nil, proxy.Direct)
+ var (
+ u *url.URL
+ err error
+ dialer proxy.Dialer
+ )
+ if u, err = url.Parse(proxyAddr); err == nil {
+ dialer, err = proxy.FromURL(u, proxy.Direct)
+ }
// It would be nice if we could return the error here. But we can't
// change our API so just keep returning it in the returned Dial function.
// Besides the implementation of proxy.SOCKS5() at the time of writing this