torproxy

package
v0.1.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TLSOptions added in v0.0.2

type TLSOptions struct {
	Domains    []string
	Email      string
	UseStaging bool
	TLSKey     string
	TLSCert    string
}

TLSOptions defines the domains we need to obtain and renew a TLS cerficate

type TorClient

type TorClient struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

TorClient holds the Host and Port for the tor client and if useEmbedded=true means is using an embedded tor client instance

func NewTorEmbedded added in v0.0.2

func NewTorEmbedded() (*TorClient, error)

NewTorEmbedded starts the embedded tor client

func (*TorClient) Close added in v0.0.2

func (tc *TorClient) Close() error

Close stops the tor client

type TorProxy

type TorProxy struct {
	Address   string
	Domains   []string
	Client    *TorClient
	Redirects []*url.URL

	Listener net.Listener
	// contains filtered or unexported fields
}

TorProxy holds the tor client details and the list cleartext addresses to be redirect to the onions URLs

func NewTorProxy

func NewTorProxy() (*TorProxy, error)

NewTorProxy starts an embedded tor client and returns a default *TorProxy on the canonical localhost:9050

func NewTorProxyFromHostAndPort

func NewTorProxyFromHostAndPort(torHost string, torPort int) (*TorProxy, error)

NewTorProxyFromHostAndPort returns a *TorProxy with givnen host and port

func (*TorProxy) Serve

func (tp *TorProxy) Serve(address string, options *TLSOptions) error

Serve starts a HTTP/1.x reverse proxy for all cleartext requests to the registered Onion addresses. An address to listent for TCP packets must be given. TLS will be enabled if a non-nil *TLSOptions is given. CertMagic will obtain, store and renew certificates for the domains. By default, CertMagic stores assets on the local file system in $HOME/.local/share/certmagic (and honors $XDG_DATA_HOME if set). CertMagic will create the directory if it does not exist. If writes are denied, things will not be happy, so make sure CertMagic can write to it! For each onion address we get to know thanks the WithRedirects method, we register a URL.path like host:port/<just_onion_host_without_dot_onion>/[<grpc_package>.<grpc_service>/<grpc_method>] Each incoming request will be proxied to <just_onion_host_without_dot_onion>.onion/[<grpc_package>.<grpc_service>/<grpc_method>]

func (*TorProxy) WithRedirects

func (tp *TorProxy) WithRedirects(redirects []string) error

WithRedirects modify the TorProxy struct with givend from -> to map

Jump to

Keyboard shortcuts

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