-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
SOCKS5 is capable of proxying multiple connections. I think there is no need to make a separate proxy connection for each HTTP(S) request.
fasthttp/fasthttpproxy/socks5.go
Lines 17 to 25 in 8ce231e
| func FasthttpSocksDialer(proxyAddr string) fasthttp.DialFunc { | |
| return func(addr string) (net.Conn, error) { | |
| dialer, err := proxy.SOCKS5("tcp", proxyAddr, nil, proxy.Direct) | |
| if err != nil { | |
| return nil, err | |
| } | |
| return dialer.Dial("tcp", addr) | |
| } | |
| } |
Should be replaced with code like:
func FasthttpSocksDialer(proxyAddr string) (fasthttp.DialFunc, error) {
dialer, err := proxy.SOCKS5("tcp", proxyAddr, nil, proxy.Direct)
if err != nil {
return nil, err
}
return func(addr string) (net.Conn, error) {
return dialer.Dial("tcp", addr)
}, nil
}Or replace it with Docs, like
// Example usage:
// Make a proxy dialer
// dialer, err := proxy.SOCKS5("tcp", "localhost:9050", nil, proxy.Direct)
// And use it in Client
// c := &fasthttp.Client{
// Dial: func(addr string) (net.Conn, error) {
// return dialer.Dial("tcp", addr)
// },
// }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels