httptor

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

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

Go to latest
Published: Sep 30, 2020 License: MIT Imports: 2 Imported by: 0

README

httptor.go

Use Tor with http.DefaultClient. Make sure you have tor running on localhost:9050.

Installation

Install using:

go get github.com/servusDei2018/httptor

Usage

By merely importing it (see below), http.DefaultClient now leverages the power of Tor.

import _ "github.com/servusDei2018/httptor"

Example

package main

import (
	"io"
	"log"
	"net/http"
	"os"

	_ "github.com/servusDei2018/httptor"
)

func main() {
	resp, err := http.Get("https://check.torproject.org/api/ip")
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()

	if _, err := io.Copy(os.Stdout, resp.Body); err != nil {
		log.Fatal(err)
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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