wire

package
v2.3.0-beta17 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package wire provides encoding and decoding operation of MySQL packets.

Index

Constants

View Source
const RESET = 0x00

Variables

This section is empty.

Functions

func DecodePayload

func DecodePayload(ctx context.Context, logger *zap.Logger, data []byte, clientConn net.Conn, decodeCtx *DecodeContext) (*mysql.PacketBundle, error)

DecodePayload is used to decode mysql packets that don't consist of multiple packets within them, because we are reading per packet.

func EncodeToBinary

func EncodeToBinary(ctx context.Context, logger *zap.Logger, packet *mysql.PacketBundle, clientConn net.Conn, decodeCtx *DecodeContext) ([]byte, error)

func GetCachingSha2PasswordMechanism

func GetCachingSha2PasswordMechanism(data byte) (string, error)

func GetPluginName

func GetPluginName(buf interface{}) (string, error)

func IsGenericResponsePkt

func IsGenericResponsePkt(packet *mysql.PacketBundle) bool

func IsNoResponseCommand

func IsNoResponseCommand(command string) bool

func PrintByteArray

func PrintByteArray(name string, b []byte)

PrintByteArray is only for debugging purpose

func StringToCachingSha2PasswordMechanism

func StringToCachingSha2PasswordMechanism(data string) (mysql.CachingSha2Password, error)

Types

type DecodeContext

type DecodeContext struct {
	Mode               models.Mode
	LastOp             *LastOperation
	PreparedStatements map[uint32]*mysql.StmtPrepareOkPacket
	ServerGreetings    *ServerGreetings
	ClientCapabilities uint32
	PluginName         string
}

type LastOperation

type LastOperation struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewLastOpMap

func NewLastOpMap() *LastOperation

func (*LastOperation) Load

func (lo *LastOperation) Load(key net.Conn) (value byte, ok bool)

func (*LastOperation) Store

func (lo *LastOperation) Store(key net.Conn, value byte)

type ServerGreetings

type ServerGreetings struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewGreetings

func NewGreetings() *ServerGreetings

func (*ServerGreetings) Load

func (*ServerGreetings) Store

func (sg *ServerGreetings) Store(key net.Conn, value *mysql.HandshakeV10Packet)

Directories

Path Synopsis
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
Package phase contains the encoding and decoding functions for the different phases of the MySQL protocol.
conn
Package conn provides decoding and encoding of connection phase mysql packets
Package conn provides decoding and encoding of connection phase mysql packets
query
Package query provides functions to decode MySQL command phase packets.
Package query provides functions to decode MySQL command phase packets.
query/preparedstmt
Package preparedstmt provides functionality for decoding prepared statement packets.
Package preparedstmt provides functionality for decoding prepared statement packets.
query/rowscols
Package rowscols provides encoding and decoding of MySQL row & column packets.
Package rowscols provides encoding and decoding of MySQL row & column packets.
query/utility
Package utility provides encoding and decoding of utility command packets.
Package utility provides encoding and decoding of utility command packets.

Jump to

Keyboard shortcuts

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