torproxy

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

README

Torproxy

An easy way to proxy your http requests through the onion network

state release license

NOTE: This is a beta release, we do not consider it completely production ready yet. Use at your own risk.

Route your http requests through the onion network without Tor browser

Using Torproxy

Note: The master branch is using Caddy v2, if you want to use Torproxy with previous caddy versions, check the caddy-v1 branch.

If you want Torproxy to start a fresh instance of Tor, you need to install Tor on your machine. Take a look at the Tor download instructions

You can get torproxy as a plugin on Caddy's v1 build server.

Or install torproxy's v2 version using go get:

go get go.okkur.org/torproxy/cmd/torproxy

Create a config file like the example below. For more information about the available config options, check the Configuration page.

example.test {
  torproxy example.test somewhereonthe.onion 
}

You can run torproxy with Caddyfile config adapter using this command:

torproxy start -config torproxy.config -adapter caddyfile

Take a look at our full documentation.

Support

For detailed information on support options see our support guide.

Helping out

Best place to start is our contribution guide.


Code is licensed under the Apache License, Version 2.0.
Documentation/examples are licensed under Creative Commons BY-SA 4.0.
Illustrations, trademarks and third-party resources are owned by their respective party and are subject to different licensing.


Copyright 2019 - The Torproxy authors

Documentation

Index

Constants

View Source
const DefaultOnionServicePort = 4242

DefaultOnionServicePort is the port used to serve the onion service on

Variables

This section is empty.

Functions

func TorConstructor added in v0.3.0

func TorConstructor() (caddy.Destructor, error)

TorConstructor return a new instance of Tor client struct. Used to manage the Tor client's life cycle

Types

type Config

type Config struct {
	To     map[string]string
	Client *Tor
}

TorProxy config

func (Config) Proxy

func (c Config) Proxy(w http.ResponseWriter, r *http.Request) error

Proxy redirects the request to the local onion service and the actual proxying happens inside onion service's http handler

type Tor

type Tor struct {
	// Socks5 proxy port
	Host      string
	Port      int
	DataDir   string
	Torrc     string
	DebugMode bool
	LogFile   string
	// contains filtered or unexported fields
}

Tor instance config struct

func (*Tor) Destruct added in v0.3.0

func (t *Tor) Destruct() error

Destruct stops the Tor client

func (*Tor) IsInstalled added in v0.3.0

func (t *Tor) IsInstalled() error

IsInstalled checks the Tor client using the `tor --version` command

func (*Tor) ParseTor

func (t *Tor) ParseTor(d *caddyfile.Dispenser) error

ParseTor parses advanced config for Tor client

func (*Tor) SetDefaults

func (t *Tor) SetDefaults()

SetDefaults sets the default values for prometheus config if the fields are empty

func (*Tor) Start

func (t *Tor) Start()

func (*Tor) Stop

func (t *Tor) Stop() error

Stop stops the tor instance, context listener and the onion service

type TorProxy

type TorProxy struct {
	Config Config
	// contains filtered or unexported fields
}

func (TorProxy) CaddyModule added in v0.3.0

func (TorProxy) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (TorProxy) ServeHTTP

func (t TorProxy) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*TorProxy) UnmarshalCaddyfile added in v0.3.0

func (t *TorProxy) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

type TorResponse

type TorResponse struct {
	// contains filtered or unexported fields
}

func (*TorResponse) Body

func (t *TorResponse) Body() []byte

Body returns response's body. This method should only get called after WriteBody()

func (*TorResponse) Header

func (t *TorResponse) Header() http.Header

Header returns response headers

func (*TorResponse) Redirect added in v0.2.1

func (t *TorResponse) Redirect() error

Redirect redirects the request to the previous response's Location header.

func (*TorResponse) ReplaceBody

func (t *TorResponse) ReplaceBody(scheme, to, host string) error

func (*TorResponse) Write

func (t *TorResponse) Write(body []byte) (int, error)

func (*TorResponse) WriteBody

func (t *TorResponse) WriteBody() error

func (*TorResponse) WriteHeader

func (t *TorResponse) WriteHeader(status int)

WriteHeader Writes the given status code to response

Directories

Path Synopsis
cmd
cmds
torproxy Module

Jump to

Keyboard shortcuts

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