Tor is an anonymity service that attempts to protect your privacy. Do not use Tor unless you fully understand all of the implications. Read more about Tor at https://www.torproject.org. This example demonstrates how to use Tor when making a request, but this applies equally to other SOCKS5 proxies.
To use a SOCKS5 proxy, the only modification needed is with the URL string of the proxy. Instead of using the HTTP protocol, use the socks5:// protocol prefix.
The default Tor port is 9050, or 9150 when using the Tor Browser bundle. The following example will perform a GET request for check.torproject.org, which will let you know if you are properly routing through the Tor network:
package mainimport ( "io/ioutil" "log" ...