tss/exp/tor/proxy.go
2022-04-29 13:38:49 -04:00

31 lines
686 B
Go

package main
import (
"io"
"log"
"net/http"
"net/url"
)
func main() {
//proxyUrl, err := url.Parse("socks5://unix//run/tor/socks")
proxyUrl, err := url.Parse("socks5://127.0.0.1:9050/#Foo")
if err != nil {
log.Panicln(err)
}
log.Println(len(proxyUrl.Path))
client := http.Client{
Transport: &http.Transport{
Proxy: func(*http.Request) (*url.URL, error) { return proxyUrl, nil },
},
}
// res, err := client.Get("http://hz3ppwwc55ccokb63r4ou7za45c5raodu23absuregtqo5ha3h37gfyd.onion")
res, err := client.Get("https://ip.balki.me")
if err != nil {
log.Panicln(err)
}
data, err := io.ReadAll(res.Body)
log.Printf("data: %s, status: %s\n", data, res.Status)
}