Documentation
¶
Overview ¶
Package postgres provides tools to parsing of in-flight / forwarded PostgreSQL packets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented indicates a method or message type is not implemented. ErrNotImplemented = errors.New("not implemented") // ErrParsingClientMessage indicates a failure occurred when parsing a TCP // packet as a PostgreSQL client message. ErrParsingClientMessage = errors.New("failed to parse TCP packet as PostgesSQL client message") // ErrParsingServerMessage indicates a failure occurred when parsing a TCP // packet as a PostgreSQL server message. ErrParsingServerMessage = errors.New("failed to parse TCP packet as PostgesSQL server message") )
Functions ¶
func DescribeBackendMessage ¶
DescribeBackendMessage tries to determine the **type** of backend message based on the first few bytes of the TCP chunk.
func ParseChunk ¶
ParseChunk parses a TCP packet as a PostgreSQL packet. This assumes a discrete TCP packet contains exactly one PostgreSQL packet, but this assumption may be revisted at a later time.
See: - https://godoc.org/github.com/jackc/pgproto3 - https://www.postgresql.org/docs/13/protocol-message-formats.html
Types ¶
type Byte1pMessage ¶
type Byte1pMessage struct {
Data string
}
Byte1pMessage is a stand-in for the four different message formats that all share `Byte1('p')`: - `GSSResponse` - `Byte1pMessage` - `SASLInitialResponse` - `SASLResponse`
func (*Byte1pMessage) Decode ¶
func (bm *Byte1pMessage) Decode(src []byte) error
Decode decodes src into `dst`. `src` must contain the complete message with the exception of the initial 1 byte message type identifier and 4 byte message length.
func (*Byte1pMessage) Encode ¶
func (bm *Byte1pMessage) Encode(dst []byte) []byte
Encode encodes `src` into `dst`. `dst` will include the 1 byte message type identifier and the 4 byte message length.
func (*Byte1pMessage) Frontend ¶
func (*Byte1pMessage) Frontend()
Frontend identifies this message as sendable by a PostgreSQL frontend.