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