gotorsocks - Easy to use Golang's torify. Provides CLI access to Tor proxying inside of Go apps. So, can parse web-sites on the .onion domens.
It is GitHub fork of this BitBucket's repo.
Old import path "code.google.com/p/go.net/proxy" (same as "golang.org/x/net/proxy") used in original version, is deadly broken, so original package uninstallable. In current version import path corrected, and some detail of code is changed.
Project uses Glide for dependencies manage. So, install Glide first:
curl https://glide.sh/get | shClone repo:
git clone https://github.com/hIMEI29A/gotorsocks.git
cd gotorsocksUpdate deps and install:
glide update
glide installIt will install dependencies ("golang.org/x/net/proxy" only) to vendor/ folder of the repo.
Run
makeIt will run tests and if it passed, install gotorsocks in to your $GOPATH
Also you can simply
go get github.com/hIMEI29A/gotorsocksCheck the release page!
package main
import (
"bufio"
"fmt"
"github.com/hIMEI29A/gotorsocks"
)
func main() {
address := "facebookcorewwwi.onion:80"
tor, err := gotorsocks.NewTorGate()
if err != nil {
panic(err)
}
connect, err := tor.DialTor(address)
if err != nil {
panic(err)
}
fmt.Fprintf(connect, "GET / HTTP/1.0\r\n\r\n")
status, err := bufio.NewReader(connect).ReadString('\n')
fmt.Println(status)
}