Socks5 proxy, remote host tcp connection timeout

I try to make request to remote host through socks5 proxy, but have problem with timeout.
Seems like timeout that I’ve set was ignored, because application stuck for 2 minutes

I have next code

		dialer, socks_err := proxy.SOCKS5("tcp", proxyAddr,
			&net.Dialer {
				Timeout: time.Second * 5,

		if err != nil {
			fmt.Println("can't connect to the proxy:", err)

		connection, err = dialer.Dial("tcp", "") // here is application  stuck and after 2 minutes I see error "i/o timeout"


Seems like timeout, that I’ve set, works only with connection to proxy server, but not works with connection to remote host.

How can I set timeout for remote host connection/request?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.