Documentation
¶
Overview ¶
Package tunnel 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 EventSink
- type Option
- func WithBrowserCommand(browserCommand string) Option
- func WithDestinationHost(dstHost string) Option
- func WithJWTCache(jwtCache jwt.Cache) Option
- func WithProxyHost(proxyHost string) Option
- func WithServiceAccount(serviceAccount string) Option
- func WithServiceAccountFile(file string) Option
- func WithTLSConfig(tlsConfig *tls.Config) Option
- type TCPTunneler
- type Tunnel
- func (tun *Tunnel) Run(ctx context.Context, local io.ReadWriter, eventSink EventSink) error
- func (tun *Tunnel) RunListener(ctx context.Context, listenerAddress string) error
- func (tun *Tunnel) RunUDPListener(ctx context.Context, listenerAddress string) error
- func (tun *Tunnel) RunUDPSessionManager(ctx context.Context, conn *net.UDPConn, eventSink EventSink) error
- type UDPDatagram
- type UDPDatagramReader
- type UDPDatagramReaderWriter
- type UDPDatagramWriter
- type UDPTunneler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventSink ¶
type EventSink 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)
}
EventSink is used to notify on the tunnel state transition
func DiscardEvents ¶
func DiscardEvents() EventSink
DiscardEvents returns an event sink that discards all events.
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 ¶
WithServiceAccount sets the service account in the config.
func WithServiceAccountFile ¶
WithServiceAccountFile sets the service account file in the config.
func WithTLSConfig ¶
WithTLSConfig returns an option to configure the tls config.
type TCPTunneler ¶
type TCPTunneler interface {
Name() string
TunnelTCP(
ctx context.Context,
eventSink EventSink,
local io.ReadWriter,
rawJWT string,
) error
}
A TCPTunneler tunnels TCP traffic.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
A Tunnel represents a TCP tunnel over HTTP Connect.
func (*Tunnel) Run ¶
Run establishes a TCP tunnel via HTTP Connect and forwards all traffic from/to local.
func (*Tunnel) RunListener ¶
RunListener runs a network listener on the given address. For each incoming connection a new TCP tunnel is established via Run.
func (*Tunnel) RunUDPListener ¶
RunUDPListener runs the udp listener.
type UDPDatagram ¶
A UDPDatagram represents a udp datagram.
func (UDPDatagram) ContextID ¶
func (d UDPDatagram) ContextID() uint64
ContextID is the context id of a udp datagram.
func (UDPDatagram) Payload ¶
func (d UDPDatagram) Payload() []byte
Payload is the payload of a udp datagram.
type UDPDatagramReader ¶
type UDPDatagramReader interface {
ReadDatagram(ctx context.Context) (UDPDatagram, error)
}
A UDPDatagramReader reads udp datagrams.
type UDPDatagramReaderWriter ¶
type UDPDatagramReaderWriter interface {
UDPDatagramReader
UDPDatagramWriter
}
A UDPDatagramReaderWriter reads and writes udp datagrams.
type UDPDatagramWriter ¶
type UDPDatagramWriter interface {
WriteDatagram(ctx context.Context, datagram UDPDatagram) error
}
A UDPDatagramWriter writes udp datagrams.
type UDPTunneler ¶
type UDPTunneler interface {
Name() string
TunnelUDP(
ctx context.Context,
eventSink EventSink,
local UDPDatagramReaderWriter,
rawJWT string,
) error
}
A UDPTunneler tunnels udp traffic.