pgwire

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardPostAuth

func ForwardPostAuth(fe *pgproto3.Frontend, client net.Conn) error

ForwardPostAuth forwards ParameterStatus, BackendKeyData, and ReadyForQuery messages from upstream to the client. Returns when ReadyForQuery is received. The fe parameter should be the Frontend returned by HandleUpstreamAuth to share the same buffered reader.

func HandleUpstreamAuth

func HandleUpstreamAuth(conn net.Conn, user, password string) (*pgproto3.Frontend, error)

HandleUpstreamAuth handles the authentication exchange with the upstream PostgreSQL server. Supports CleartextPassword, MD5Password, and SASL (SCRAM-SHA-256). Returns the pgproto3 Frontend so that callers (e.g. ForwardPostAuth) can continue reading from the same buffered reader.

func ReadStartupMessage

func ReadStartupMessage(conn net.Conn) (*pgproto3.StartupMessage, error)

ReadStartupMessage reads the initial PG startup message from the client. Handles SSL negotiation (denies SSL, client retries with plaintext).

func SendAuthOK

func SendAuthOK(conn net.Conn) error

SendAuthOK sends AuthenticationOk to the client.

func SendErrorResponse

func SendErrorResponse(conn net.Conn, severity, code, message string)

SendErrorResponse sends a PG ErrorResponse to the client.

func WriteStartupMessage

func WriteStartupMessage(conn net.Conn, user, database string, params map[string]string) error

WriteStartupMessage sends a startup message to the upstream backend.

Types

This section is empty.

Jump to

Keyboard shortcuts

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