A proxy to sniff postgres wire protocol traffic.
pgroxy sits between a client and a postgres server. It copies data between the client and the server while decoding the passing protocol packets and dumping them on stdout.
+--------+ +--------+ +----------+
| client | <---> | pgroxy | <---> | postgres |
+--------+ +--------+ +----------+
|
V
+--------+
| stdout |
+--------+
pgroxy
needs both a listen address and an upstream address. E.g. to listen on
port 8080 and connect to a postgres server at 5432 run the following:
cargo run -- --listen localhost:8080 --connect localhost:5432
With this pgroxy
will start listening on localhost:8080. Now connect your Postgres client to localhost:8080 instead of localhost:5432 to observe the Postgres wire protocol messages.
(from https://www.postgresql.org/docs/current/protocol-message-formats.html):
- AuthenticationOk
- AuthenticationKerberosV5
- AuthenticationCleartextPassword
- AuthenticationMD5Password
- AuthenticationGSS
- AuthenticationGSSContinue
- AuthenticationSSPI
- AuthenticationSASL
- AuthenticationSASLContinue
- AuthenticationSASLFinal
- BackendKeyData
- Bind
- BindComplete
- CancelRequest
- Close
- CloseComplete
- CommandComplete
- CopyData
- CopyDone
- CopyFail
- CopyInResponse
- CopyOutResponse
- CopyBothResponse
- DataRow
- Describe
- EmptyQueryResponse
- ErrorResponse
- Execute
- Flush
- FunctionCall
- FunctionCallResponse
- GSSENCRequest
- GSSResponse
- NegotiateProtocolVersion
- NoData
- NoticeResponse
- NotificationResponse
- ParameterDescription
- ParameterStatus
- Parse
- ParseComplete
- PasswordMessage
- PortalSuspended
- Query
- ReadyForQuery
- RowDescription
- SASLInitialResponse
- SASLResponse
- SSLRequest
- StartupMessage
- Sync
- Terminate