gotor

package module
v0.0.0-...-c8454dc Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: MIT Imports: 5 Imported by: 1

README

GoDoc MIT Licence Go Report Card

gotor

a tor client package using golang

Install

go get github.com/FrozenKP/gotor

Example

package main

import (
	"io/ioutil"
	"log"
	"time"

	"github.com/FrozenKP/gotor"
)

// URL to fetch
var webUrl string = "http://www.google.com"

func main() {
        // get tor client
	client := gotor.New(time.Second * 30)
	
	// Make request
	resp, err := client.Get(webUrl)
	if err != nil {
		log.Fatal("Error making GET request.", err)
	}
	defer resp.Body.Close()

	// Read response
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal("Error reading body of response.", err)
	}
	log.Println(string(body))
	log.Println("Return status code:", resp.StatusCode)
}

Documentation

Overview

Package gotor is a package to generate a simple tor client.

code original from http://www.devdungeon.com/content/making-tor-http-requests-go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(timeOut time.Duration, InputProxy ...string) *http.Client

New return a tor client.

Using "socks5://127.0.0.1:9050" as proxy in default, you can put your own proxy in paramemter to replace it.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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