pgproxy

package
v0.398.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 6 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 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(address 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) error

Start the proxy.

Jump to

Keyboard shortcuts

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