h12w / socks

A SOCKS (SOCKS4, SOCKS4A and SOCKS5) Proxy Package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timeout does not work with fasthttp.Client

Numenorean opened this issue · comments

Hello, I've faced with an issue when timeout param doesn't work with fasthttp client. Here is my func which i pass as an field Dial to the fasthttp.Client

func(addr string) (net.Conn, error) {
			dialer := socks.Dial(proxyAddr + "?timeout=4s")
			return dialer("tcp", addr)
		}

and prepare the client:

fasthttp.Client{
		Dial: prepareProxy(proxy),
	}

I must admit that with a valid proxy it works

I found and fixed an issue where the timeout is not applied during the TCP dialing but only works after the connection is established. Could you fetch the latest v1.0.3 and give it a try?

@h12w thank you so much for replying right away, now it works