pgproxy

package
v0.411.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleConnection added in v0.398.1

func HandleConnection(ctx context.Context, conn net.Conn, connectionFn DSNConstructor)

HandleConnection proxies a single connection.

This should be run as the first thing after accepting a connection. It will block until the connection is closed.

Types

type Config added in v0.399.0

type Config struct {
	Listen string `name:"listen" short:"l" help:"Address to listen on." env:"FTL_PROXY_PG_LISTEN" default:"127.0.0.1:5678"`
}

type DSNConstructor

type DSNConstructor func(ctx context.Context, params map[string]string) (string, error)

DSNConstructor is a function that constructs a new connection string from parameters of the incoming connection.

parameters are pg connection parameters as described in https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS

type PgProxy

type PgProxy struct {
	// contains filtered or unexported fields
}

PgProxy is a configurable proxy for PostgreSQL connections

func New

func New(listenAddress string, connectionFn DSNConstructor) *PgProxy

New creates a new PgProxy.

address is the address to listen on for incoming connections. connectionFn is a function that constructs a new connection string from parameters of the incoming connection.

func (*PgProxy) Start

func (p *PgProxy) Start(ctx context.Context, started chan<- Started) error

Start the proxy

type Started added in v0.399.0

type Started struct {
	Address *net.TCPAddr
}

Jump to

Keyboard shortcuts

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