From 67a3e67bdaf915cb6253b0b67fba0e76548775b1 Mon Sep 17 00:00:00 2001 From: Matias Insaurralde Date: Tue, 7 Jun 2016 21:47:14 -0400 Subject: [PATCH] Tor dialer generic function --- transport.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/transport.go b/transport.go index 864e892..2db94e5 100644 --- a/transport.go +++ b/transport.go @@ -2,6 +2,7 @@ package transports import ( "net/http" + "golang.org/x/net/proxy" ) type Transport struct { @@ -19,3 +20,11 @@ func (t *Transport) Handler(w http.ResponseWriter, req *http.Request) { func (t *Transport) Listen() { return } + +func TorDialer() (proxy.Dialer) { + dialer, err := proxy.SOCKS5("tcp", "127.0.0.1:9050", nil, proxy.Direct) + if err != nil { + panic(err) + } + return dialer +}