Documentation
¶
Overview ¶
Package tcptunnel contains an implementation of a TCP tunnel via HTTP Connect.
Index ¶
- func ParseURLs(destination string, pomeriumURL string) (destinationAddr string, proxyURL *url.URL, err error)
- type Option
- func WithBrowserCommand(browserCommand string) Option
- func WithDestinationHost(dstHost string) Option
- func WithJWTCache(jwtCache jwt.JWTCache) Option
- func WithProxyHost(proxyHost string) Option
- func WithServiceAccount(serviceAccount string) Option
- func WithServiceAccountFile(file string) Option
- func WithTLSConfig(tlsConfig *tls.Config) Option
- type Tunnel
- type TunnelEvents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*config)
An Option modifies the config.
func WithBrowserCommand ¶
WithBrowserCommand returns an option to configure the browser command.
func WithDestinationHost ¶
WithDestinationHost returns an option to configure the destination host.
func WithJWTCache ¶
WithJWTCache returns an option to configure the jwt cache.
func WithProxyHost ¶
WithProxyHost returns an option to configure the proxy host.
func WithServiceAccount ¶ added in v0.21.0
WithServiceAccount sets the service account in the config.
func WithServiceAccountFile ¶ added in v0.21.0
WithServiceAccountFile sets the service account file in the config.
func WithTLSConfig ¶
WithTLSConfig returns an option to configure the tls config.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
A Tunnel represents a TCP tunnel over HTTP Connect.
func (*Tunnel) Run ¶
func (tun *Tunnel) Run(ctx context.Context, local io.ReadWriter, evt TunnelEvents) error
Run establishes a TCP tunnel via HTTP Connect and forwards all traffic from/to local.
type TunnelEvents ¶
type TunnelEvents interface { // OnConnecting is called when listener is accepting a new connection from client OnConnecting(context.Context) // OnConnected is called when a connection is successfully // established to the remote destination via pomerium proxy OnConnected(context.Context) // OnAuthRequired is called after listener accepted a new connection from client, // but has to perform user authentication first OnAuthRequired(context.Context, string) // OnDisconnected is called when connection to client was closed OnDisconnected(context.Context, error) }
TunnelEvents is used to notify on the tunnel state transition
func DiscardEvents ¶
func DiscardEvents() TunnelEvents
DiscardEvents returns a broadcaster that discards all events