tor

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: AGPL-3.0-or-later Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TorBrowserBundleProxyURL is the URL to the local SOCKS5 proxy
	// started by the Tor Browser Bundle. Set 'ProxyURL' to this if
	// you're using -- you guessed it -- the Tor Browser Bundle.
	TorBrowserBundleProxyURL = "socks5://127.0.0.1:9150"

	// TorServiceProxyURL is the URL to the local SOCKS5 proxy started
	// by the Tor service/daemon. Set 'ProxyURL' to this if you have
	// the Tor service installed on your machine.
	TorServiceProxyURL = "socks5://127.0.0.1:9050"

	// ProxyURL is the URL of the local SOCKS5 proxy used to make
	// requests over Tor. Defaults to TorBrowserBundleProxyURL.
	//
	// Local proxy port used to make requests over Tor can be set with
	// TOR_PORT environment variable (in which case ProxyURL gets set
	// to "127.0.0.1:${TOR_PORT}").
	ProxyURL = TorBrowserBundleProxyURL
)

Functions

func DoRequest

func DoRequest(client *http.Client, method, url string, body io.Reader) (*http.Response, error)

DoRequest performs the given request through Tor, using socks5://127.0.0.1:9150 (change ProxyURL to use different proxy). If client is nil, a client is created (with NewClient).

func Get

func Get(url string) (*http.Response, error)

Get does a GET request to the given URL over Tor.

func NewClient

func NewClient() (*http.Client, error)

NewClient returns an HTTP client that does requests through Tor.

func NewRequest

func NewRequest(method, url string, body io.Reader) (*http.Request, error)

NewRequest creates a *http.Request with the User-Agent set to what Tor Browser uses.

func Post

func Post(url string, body io.Reader) (*http.Response, error)

Post does a POST request to the given URL over Tor.

Types

This section is empty.

Jump to

Keyboard shortcuts

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