torproxy

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 17 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
}

type TorProxy

type TorProxy struct {
	Address   string
	Domains   []string
	Client    *TorClient
	Registry  registry.Registry
	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 NewTorProxyFromHostAndPort

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

NewTorProxyFromHostAndPort returns a *TorProxy with givnen host and port

func (*TorProxy) Close added in v0.1.1

func (tp *TorProxy) Close() error

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) WithAutoUpdater added in v0.1.1

func (tp *TorProxy) WithAutoUpdater(period time.Duration, errorHandler func(err error))

WithAutoUpdater starts a go-routine selecting results of registry.Observe set up a stop function in TorProxy to stop the go-routine in Close method

func (*TorProxy) WithRegistry added in v0.1.1

func (tp *TorProxy) WithRegistry(regis registry.Registry) error

Jump to

Keyboard shortcuts

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