From 0de7b76cbc155622202f129bef325b337c715bce Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Sun, 2 Oct 2016 17:36:49 -0700 Subject: [PATCH] Replacing proxy dependency with golang.org/x/net/proxy --- Makefile | 2 +- standardricochetservice.go | 2 +- utils/networkresolver.go | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b349943..793977e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ all: - go install github.com/go-ricochet + go install github.com/s-rah/go-ricochet test: go test -v github.com/s-rah/go-ricochet/... diff --git a/standardricochetservice.go b/standardricochetservice.go index 11de4a0..e1e399c 100644 --- a/standardricochetservice.go +++ b/standardricochetservice.go @@ -67,7 +67,7 @@ func (srs *StandardRicochetService) Connect(hostname string) error { log.Printf("Connecting to...%s", hostname) oc, err := srs.ricochet.Connect(hostname) if err != nil { - return errors.New("Could not connect to: " + hostname) + return errors.New("Could not connect to: " + hostname + " " + err.Error()) } oc.MyHostname = srs.serverHostname return nil diff --git a/utils/networkresolver.go b/utils/networkresolver.go index 021c568..9395773 100644 --- a/utils/networkresolver.go +++ b/utils/networkresolver.go @@ -2,7 +2,7 @@ package utils import ( "errors" - "h12.me/socks" + "golang.org/x/net/proxy" "net" "strings" ) @@ -38,8 +38,12 @@ func (nr *NetworkResolver) Resolve(hostname string) (net.Conn, string, error) { resolvedHostname = addrParts[1] } - dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, "127.0.0.1:9050") - conn, err := dialSocksProxy("", resolvedHostname+".onion:9878") + torDialer, err := proxy.SOCKS5("tcp", "127.0.0.1:9050", nil, proxy.Direct) + if err != nil { + return nil,"", err + } + + conn, err := torDialer.Dial("tcp", resolvedHostname+".onion:9878") if err != nil { return nil, "", errors.New("Cannot Dial Remote Ricochet Address") }