MySQLProtocol

package
v0.0.0-...-34a39c5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COM_SLEEP               = 0x00
	COM_QUIT                = 0x01
	COM_INIT_DB             = 0x02
	COM_QUERY               = 0x03
	COM_FIELD_LIST          = 0x04
	COM_CREATE_DB           = 0x05
	COM_DROP_DB             = 0x06
	COM_REFRESH             = 0x07
	COM_SHUTDOWN            = 0x08
	COM_STATISTICS          = 0x09
	COM_PROCESS_INFO        = 0x0a
	COM_CONNECT             = 0x0b
	COM_PROCESS_KILL        = 0x0c
	COM_DEBUG               = 0x0d
	COM_PING                = 0x0e
	COM_TIME                = 0x0f
	COM_DELAYED_INSERT      = 0x10
	COM_CHANGE_USER         = 0x11
	COM_BINLOG_DUMP         = 0x12
	COM_TABLE_DUMP          = 0x13
	COM_CONNECT_OUT         = 0x14
	COM_REGISTER_SLAVE      = 0x15
	COM_STMT_PREPARE        = 0x16
	COM_STMT_EXECUTE        = 0x17
	COM_STMT_SEND_LONG_DATA = 0x18
	COM_STMT_CLOSE          = 0x19
	COM_STMT_RESET          = 0x1a
	COM_SET_OPTION          = 0x1b
	COM_STMT_FETCH          = 0x1c
)

MySQL packet type constants

Variables

View Source
var LocalDBConfigParams = LocalDBConfig{}

LocalDBConfig instance

View Source
var ProcUserMap map[string]*ProcUser = make(map[string]*ProcUser)

Hashmap for processlist

View Source
var QanAgentConfigParams = QanAgentConfig{}

QanAgentConfig instance

View Source
var SourceMap map[string]*Source = make(map[string]*Source)

Hashmap for the packet information

Functions

func AnonymizeQuery

func AnonymizeQuery(queryText string) (string, string)

This function anonymizes the data from a query by replacing it with ? and calculates the checksum of the query using Percona go-query.

func GetProcesslist

func GetProcesslist()

func IsErrPacket

func IsErrPacket(payload *[]byte) bool

func ParseProtocol

func ParseProtocol(src *string, payload *[]byte, fullLength bool) (err error)

This function extracts queries from the packet. If the packet is a continuation of an earlier request, it will be added to the request. TODO: Need to add support for compressed packets and SSL connections.

Types

type LocalDBConfig

type LocalDBConfig struct {
	LocalUsername string
	LocalPassword string
	LocalSocket   string
	Enabled       uint8
}

Config struct to hold config related to connecting to local db

type ProcUser

type ProcUser struct {
	Src  string
	User string
	Db   string
}

Struct for storing the processlist

type QanAgentConfig

type QanAgentConfig struct {
	ReportInterval   uint32
	MaxRequestLength uint32
	MaxDBConnections int
	DebugLevels      string
	LogFile          string
	DebugMap         map[uint8]bool
}

Config struct to hold qan agent config section

type Source

type Source struct {
	Src               string
	QueryStartTime    time.Time
	QueryEndTime      time.Time
	RequestCount      uint16
	ResponseCount     uint16
	RequestLength     uint32
	QueryText         string
	ResponseTime      float64
	User              string
	Db                string
	NewConnection     bool
	PreparedStatement bool
	FullLength        bool
}

Struct for packet related information

Jump to

Keyboard shortcuts

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