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 ¶
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
NewTorEmbedded starts the embedded 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 ¶
NewTorProxy starts an embedded tor client and returns a default *TorProxy on the canonical localhost:9050
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) WithRedirects ¶
WithRedirects modify the TorProxy struct with givend from -> to map