Versions in this module Expand all Collapse all v0 v0.1.1 Jul 14, 2023 Changes in this version type PacketIO + func (p *PacketIO) WriteUserError(err error) + type UserError struct + func WrapUserError(err error, userMsg string) *UserError + func (ue *UserError) Error() string + func (ue *UserError) Unwrap() error + func (ue *UserError) UserMsg() string v0.1.0 May 22, 2023 Changes in this version + const FastAuthFail + const MaxPayloadLen + const ShaCommand + var Collation = uint8(mysql.DefaultCollationID) + var ConnID = 100 + var ErrCloseConn = errors.New("failed to close the connection") + var ErrExpectSSLRequest = errors.New("expect a SSLRequest packet") + var ErrFlushConn = errors.New("failed to flush the connection") + var ErrHandshakeTLS = errors.New("failed to complete tls handshake") + var ErrReadConn = errors.New("failed to read the connection") + var ErrSaltNotLongEnough = errors.New("salt is not long enough") + var ErrWriteConn = errors.New("failed to write the connection") + var ServerVersion = mysql.ServerVersion + var Status = mysql.ServerStatusAutocommit + func DumpLengthEncodedInt(buffer []byte, n uint64) []byte + func DumpLengthEncodedString(buffer []byte, bytes []byte) []byte + func DumpUint16(buffer []byte, n uint16) []byte + func DumpUint32(buffer []byte, n uint32) []byte + func IsDisconnectError(err error) bool + func IsEOFPacket(data []byte) bool + func IsErrorPacket(data []byte) bool + func IsOKPacket(data []byte) bool + func IsResultSetOKPacket(data []byte) bool + func MakeChangeUser(username, db, authPlugin string, authData []byte) []byte + func MakeHandshakeResponse(resp *HandshakeResp) []byte + func ParseChangeUser(data []byte) (username, db string) + func ParseErrorPacket(data []byte) error + func ParseLengthEncodedBytes(b []byte) ([]byte, bool, int, error) + func ParseLengthEncodedInt(b []byte) (num uint64, isNull bool, n int) + func ParseNullTermString(b []byte) (str []byte, remain []byte) + func ParseOKPacket(data []byte) *gomysql.Result + func ReadServerVersion(conn net.Conn) (string, error) + func WithProxy(pi *PacketIO) + func WithRemoteAddr(readdr string, addr net.Addr) func(pi *PacketIO) + func WithWrapError(err error) func(pi *PacketIO) + func WriteServerVersion(conn net.Conn, serverVersion string) error + type Capability uint32 + const ClientCanHandleExpiredPasswords + const ClientCapabilityExtension + const ClientCompress + const ClientConnectAttrs + const ClientConnectWithDB + const ClientDeprecateEOF + const ClientFoundRows + const ClientIgnoreSigpipe + const ClientIgnoreSpace + const ClientInteractive + const ClientLocalFiles + const ClientLongFlag + const ClientLongPassword + const ClientMultiResults + const ClientMultiStatements + const ClientNoSchema + const ClientODBC + const ClientOptionalResultsetMetadata + const ClientPSMultiResults + const ClientPluginAuth + const ClientPluginAuthLenencClientData + const ClientProtocol41 + const ClientQueryAttributes + const ClientRememberOptions + const ClientReserved + const ClientSSL + const ClientSSLVerifyServerCert + const ClientSecureConnection + const ClientSessionTrack + const ClientTransactions + const ClientZstdCompressionAlgorithm + const MultiFactorAuthentication + func ParseInitialHandshake(data []byte) (Capability, string) + func (f *Capability) MarshalText() ([]byte, error) + func (f *Capability) UnmarshalText(o []byte) error + func (f Capability) String() string + func (f Capability) Uint32() uint32 + type Command byte + const ComBinlogDump + const ComBinlogDumpGtid + const ComChangeUser + const ComConnect + const ComConnectOut + const ComCreateDB + const ComDaemon + const ComDebug + const ComDelayedInsert + const ComDeprecated1 + const ComDropDB + const ComEnd + const ComFieldList + const ComInitDB + const ComPing + const ComProcessInfo + const ComProcessKill + const ComQuery + const ComQuit + const ComRefresh + const ComRegisterSlave + const ComResetConnection + const ComSetOption + const ComSleep + const ComStatistics + const ComStmtClose + const ComStmtExecute + const ComStmtFetch + const ComStmtPrepare + const ComStmtReset + const ComStmtSendLongData + const ComTableDump + const ComTime + func (f *Command) MarshalText() ([]byte, error) + func (f *Command) UnmarshalText(o []byte) error + func (f Command) Byte() byte + func (f Command) String() string + type HandshakeResp struct + Attrs map[string]string + AuthData []byte + AuthPlugin string + Capability uint32 + Collation uint8 + DB string + User string + func ParseHandshakeResponse(data []byte) (*HandshakeResp, error) + type PacketIO struct + func NewPacketIO(conn net.Conn, opts ...PacketIOption) *PacketIO + func (p *PacketIO) ApplyOpts(opts ...PacketIOption) + func (p *PacketIO) ClientTLSHandshake(tlsConfig *tls.Config) error + func (p *PacketIO) Close() error + func (p *PacketIO) Flush() error + func (p *PacketIO) GetSequence() uint8 + func (p *PacketIO) GracefulClose() error + func (p *PacketIO) InBytes() uint64 + func (p *PacketIO) IsPeerActive() bool + func (p *PacketIO) LastKeepAlive() config.KeepAlive + func (p *PacketIO) LocalAddr() net.Addr + func (p *PacketIO) OutBytes() uint64 + func (p *PacketIO) Proxy() *proxyprotocol.Proxy + func (p *PacketIO) ReadPacket() (data []byte, err error) + func (p *PacketIO) ReadSSLRequestOrHandshakeResp() (pkt []byte, isSSL bool, err error) + func (p *PacketIO) RemoteAddr() net.Addr + func (p *PacketIO) ResetSequence() + func (p *PacketIO) ServerTLSHandshake(tlsConfig *tls.Config) (tls.ConnectionState, error) + func (p *PacketIO) SetKeepalive(cfg config.KeepAlive) error + func (p *PacketIO) TLSConnectionState() tls.ConnectionState + func (p *PacketIO) WriteEOFPacket(status uint16) error + func (p *PacketIO) WriteErrPacket(merr *mysql.SQLError) error + func (p *PacketIO) WriteInitialHandshake(capability Capability, salt []byte, authPlugin string, serverVersion string) error + func (p *PacketIO) WriteOKPacket(status uint16, header byte) error + func (p *PacketIO) WritePacket(data []byte, flush bool) (err error) + func (p *PacketIO) WriteProxyV2(m *proxyprotocol.Proxy) error + func (p *PacketIO) WriteShaCommand() error + func (p *PacketIO) WriteSwitchRequest(authPlugin string, salt []byte) error + type PacketIOption = func(*PacketIO)