packet

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBufferSize = 16 * 1024
View Source
const MinCompressionLength = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn

	Sequence uint8

	Compression uint8

	CompressedSequence uint8
	// contains filtered or unexported fields
}

Conn is the base class to handle MySQL protocol.

func NewBufferedConn

func NewBufferedConn(conn net.Conn, bufferSize int) *Conn

func NewConn

func NewConn(conn net.Conn) *Conn

func NewConnWithTimeout

func NewConnWithTimeout(conn net.Conn, readTimeout, writeTimeout time.Duration, bufferSize int) *Conn

func NewTLSConn

func NewTLSConn(conn net.Conn) *Conn

func NewTLSConnWithTimeout

func NewTLSConnWithTimeout(conn net.Conn, readTimeout, writeTimeout time.Duration) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ReadPacket

func (c *Conn) ReadPacket() ([]byte, error)

func (*Conn) ReadPacketReuseMem

func (c *Conn) ReadPacketReuseMem(dst []byte) ([]byte, error)

func (*Conn) ReadPacketTo

func (c *Conn) ReadPacketTo(w io.Writer) error

func (*Conn) ResetSequence

func (c *Conn) ResetSequence()

func (*Conn) WriteClearAuthPacket

func (c *Conn) WriteClearAuthPacket(password string) error

WriteClearAuthPacket Client clear text authentication packet https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_response.html

func (*Conn) WriteEncryptedPassword

func (c *Conn) WriteEncryptedPassword(password string, seed []byte, pub *rsa.PublicKey) error

func (*Conn) WritePacket

func (c *Conn) WritePacket(data []byte) error

WritePacket data already has 4 bytes header will modify data in-place

func (*Conn) WritePublicKeyAuthPacket

func (c *Conn) WritePublicKeyAuthPacket(password string, cipher []byte) error

WritePublicKeyAuthPacket Caching sha2 authentication. Public key request and send encrypted password https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_auth_switch_response.html

Jump to

Keyboard shortcuts

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