I'm trying to connect to a proxy server to start an HTTP CONNECT tunnel. The proxy server uses authentication. This code however fails to work:
conn, err := net.Dial("tcp", "[user:pass@111.222.333.444]:5555")
Even though the host exists, I get an error:
"dial tcp: lookup user:pass@111.222.333.444: no such host"
The string format I'm using was described in this post. Can't seem to get it to work though. https://stackoverflow.com/a/8858209/6767074
I eventually found the problem. The net.Dial()
method wasn't the one concerned with proxy authentication.
I just had to fill in the "Proxy-Authorization" header of the request before calling for am HTTP response. So my TCP address became:
conn, err := net.Dial("tcp", "111.222.333.444:5555")