Skip to content

hIMEI29A/gotorsocks

Repository files navigation

gotorsocks

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.

Go Report Card GoDoc

Install

Project uses Glide for dependencies manage. So, install Glide first:

curl https://glide.sh/get | sh

Clone repo:

git clone https://github.com/hIMEI29A/gotorsocks.git

cd gotorsocks

Update deps and install:

glide update

glide install

It will install dependencies ("golang.org/x/net/proxy" only) to vendor/ folder of the repo.

Run

make

It will run tests and if it passed, install gotorsocks in to your $GOPATH

Also you can simply

go get github.com/hIMEI29A/gotorsocks

Check the release page!

Example

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)
}