Replacing proxy dependency with golang.org/x/net/proxy

This commit is contained in:
Sarah Jamie Lewis 2016-10-02 17:36:49 -07:00
parent 47ba383334
commit 0de7b76cbc
3 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
all: all:
go install github.com/go-ricochet go install github.com/s-rah/go-ricochet
test: test:
go test -v github.com/s-rah/go-ricochet/... go test -v github.com/s-rah/go-ricochet/...

View File

@ -67,7 +67,7 @@ func (srs *StandardRicochetService) Connect(hostname string) error {
log.Printf("Connecting to...%s", hostname) log.Printf("Connecting to...%s", hostname)
oc, err := srs.ricochet.Connect(hostname) oc, err := srs.ricochet.Connect(hostname)
if err != nil { 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 oc.MyHostname = srs.serverHostname
return nil return nil

View File

@ -2,7 +2,7 @@ package utils
import ( import (
"errors" "errors"
"h12.me/socks" "golang.org/x/net/proxy"
"net" "net"
"strings" "strings"
) )
@ -38,8 +38,12 @@ func (nr *NetworkResolver) Resolve(hostname string) (net.Conn, string, error) {
resolvedHostname = addrParts[1] resolvedHostname = addrParts[1]
} }
dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, "127.0.0.1:9050") torDialer, err := proxy.SOCKS5("tcp", "127.0.0.1:9050", nil, proxy.Direct)
conn, err := dialSocksProxy("", resolvedHostname+".onion:9878") if err != nil {
return nil,"", err
}
conn, err := torDialer.Dial("tcp", resolvedHostname+".onion:9878")
if err != nil { if err != nil {
return nil, "", errors.New("Cannot Dial Remote Ricochet Address") return nil, "", errors.New("Cannot Dial Remote Ricochet Address")
} }