Documentation
¶
Index ¶
Constants ¶
View Source
const ( DirClientToServer byte = 0x00 DirServerToClient byte = 0x01 )
Packet direction constants.
View Source
const ( ProtocolOracle = "oracle" ProtocolPostgreSQL = "postgresql" ProtocolMySQL = "mysql" )
Protocol identifiers.
View Source
const (
FileExt = ".dbbat-dump"
)
File format constants.
Variables ¶
View Source
var ( ErrInvalidMagic = errors.New("invalid dump file magic") ErrUnsupportedVersion = errors.New("unsupported dump format version") )
Errors.
Functions ¶
Types ¶
type Header ¶
type Header struct {
SessionID string `json:"session_id"`
Protocol string `json:"protocol"`
StartTime time.Time `json:"start_time"`
Connection map[string]any `json:"connection"`
}
Header holds the JSON-serializable session metadata.
type Packet ¶
type Packet struct {
RelativeNs int64 // Nanoseconds since session start
Direction byte // DirClientToServer or DirServerToClient
Data []byte // Raw protocol bytes
}
Packet represents a single captured packet.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads packets from a dump file.
func OpenReader ¶
OpenReader opens a dump file and parses the header.
func (*Reader) ReadPacket ¶
ReadPacket reads the next packet from the dump. Returns io.EOF after the EOF marker.
type TapConn ¶
TapConn wraps a net.Conn and captures all read/written bytes to a Writer. Reads are tagged with one direction, writes with the other.
func NewTapConn ¶
NewTapConn creates a connection wrapper that captures traffic to a dump Writer.
Click to show internal directories.
Click to hide internal directories.