gotorsocks

package module
v0.0.0-...-78c5837 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 5 Imported by: 2

README

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

Documentation

Index

Constants

View Source
const TOR_GATE_ string = "127.0.0.1:9050"

TOR_GATE string constant with localhost's Tor port

Variables

This section is empty.

Functions

This section is empty.

Types

type TorGate

type TorGate string

TorGate is a Tor proxy. Is actually just a string with the address of the Tor Proxy. (Needs to be an IPv4 address or a domain name that can be translated to an IPv4 address, with a port.) Examples: "127.0.0.1:9050", "10.0.30.11:9150".

func NewTorGate

func NewTorGate() (*TorGate, error)

NewTorGate creates new TorGate

func (*TorGate) DialTor

func (gate *TorGate) DialTor(address string) (net.Conn, error)

DialTor dials to the .onion address

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL