pgproxy

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MPL-2.0 Imports: 24 Imported by: 0

README

pgproxy

pgproxy is a flexible proxy for the Postgres wire protocol that allows for customizing authentication and backend selection by breaking apart the startup message flow between frontend and backend.

Once authenticated, it falls back to being a dumb proxy that simple shuffles bytes back and forth.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateClient added in v0.18.0

func AuthenticateClient(be *pgproto3.Backend) error

AuthenticateClient tells the client they've successfully authenticated.

func CopySteadyState added in v0.18.0

func CopySteadyState(client *pgproto3.Backend, server *pgproto3.Frontend) error

CopySteadyState copies messages back and forth after the initial handshake.

func FinalizeInitialHandshake added in v0.18.0

func FinalizeInitialHandshake(client *pgproto3.Backend, server *pgproto3.Frontend) (*pgproto3.BackendKeyData, error)

FinalizeInitialHandshake completes the handshake between client and server, snooping the BackendKeyData from the server if sent. It is nil if the server did not send any backend key data.

func SendCancelRequest added in v0.18.0

func SendCancelRequest(conn io.ReadWriter, req *pgproto3.CancelRequest) error

func SetupServer added in v0.18.0

func SetupServer(server net.Conn, cfg *ServerConfig) (*pgproto3.Frontend, error)

SetupServer sets up a frontend connected to the given server.

Types

type AuthData

type AuthData struct {
	Username