Categorygithub.com/frozenkp/gotor
repositorypackage
0.0.0-20170628044052-c8454dcc5cb5
Repository: https://github.com/frozenkp/gotor.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

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