proxy

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Authorize(ctx context.Context, remoteAddr string, backend string) (*auth.AuthResult, error)
}

Authorizer abstracts the identity check so that tests can supply a mock while production wiring uses the real Tailscale local client.

type PostgresProxy

type PostgresProxy struct {
	Backend       string
	Name          string
	Auth          Authorizer
	Tracker       *restrict.Tracker
	Provisioner   *provision.Provisioner
	Metrics       *metrics.Metrics
	PGConfig      *config.PostgresAdmin
	RevalInterval time.Duration
	Logger        *slog.Logger
	Dialer        func(ctx context.Context, network, addr string) (net.Conn, error)
	BytesRead     *atomic.Int64 // optional: aggregate byte counter
	BytesWritten  *atomic.Int64 // optional: aggregate byte counter
}

PostgresProxy handles PG-aware proxying with Tailscale auth, dynamic user provisioning, and mid-session revalidation.

func (*PostgresProxy) HandleConn

func (p *PostgresProxy) HandleConn(ctx context.Context, clientConn net.Conn)

HandleConn processes a single inbound PostgreSQL connection.

type TCPProxy

type TCPProxy struct {
	Backend      string
	Name         string
	Auth         Authorizer
	Tracker      *restrict.Tracker
	Metrics      *metrics.Metrics
	Logger       *slog.Logger
	Dialer       func(ctx context.Context, network, addr string) (net.Conn, error)
	BytesRead    *atomic.Int64 // optional: aggregate byte counter
	BytesWritten *atomic.Int64 // optional: aggregate byte counter
}

TCPProxy handles raw TCP proxying with Tailscale auth and limits.

func (*TCPProxy) HandleConn

func (p *TCPProxy) HandleConn(ctx context.Context, clientConn net.Conn)

HandleConn processes a single inbound TCP connection.

type TailscaleAuthorizer

type TailscaleAuthorizer struct {
	LC     *local.Client
	Logger *slog.Logger
}

TailscaleAuthorizer implements Authorizer using the Tailscale local API.

func (*TailscaleAuthorizer) Authorize

func (a *TailscaleAuthorizer) Authorize(ctx context.Context, remoteAddr string, backend string) (*auth.AuthResult, error)

Authorize delegates to auth.Authorize with the embedded local client.

Jump to

Keyboard shortcuts

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