Documentation
¶
Index ¶
- Variables
- func ForwardPostAuth(fe *pgproto3.Frontend, client net.Conn) error
- func HandleUpstreamAuth(conn net.Conn, user, password string) (*pgproto3.Frontend, error)
- func ReadStartupMessage(conn net.Conn, mode config.PostgresTLSMode, tlsConfig *tls.Config) (net.Conn, *pgproto3.StartupMessage, error)
- func SendAuthOK(conn net.Conn) error
- func SendErrorResponse(conn net.Conn, severity, code, message string)
- func UpgradeToTLS(conn net.Conn) (net.Conn, error)
- func WriteStartupMessage(conn net.Conn, user, database string, params map[string]string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrTLSRequired = errors.New("postgres client TLS required") // ErrCancelRequest indicates the client sent a Postgres CancelRequest // rather than a startup message. We do not forward query cancellation, so // the proxy treats this as a benign close rather than an error. ErrCancelRequest = errors.New("postgres cancel request") )
Functions ¶
func ForwardPostAuth ¶
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 ¶
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, mode config.PostgresTLSMode, tlsConfig *tls.Config) (net.Conn, *pgproto3.StartupMessage, error)
ReadStartupMessage reads the initial PG startup message from the client and negotiates Postgres SSL/TLS when enabled. It returns the live client connection to use for the rest of the session, which may be TLS-wrapped.
func SendAuthOK ¶
SendAuthOK sends AuthenticationOk to the client.
func SendErrorResponse ¶
SendErrorResponse sends a PG ErrorResponse to the client.
func UpgradeToTLS ¶ added in v0.4.11
UpgradeToTLS sends an SSLRequest to the backend and upgrades the connection to TLS. Returns the TLS-wrapped connection on success.
Types ¶
This section is empty.