func ReadResponse(conn net.Conn, deprecateEOF bool) ([]byte, byte, error) {
	pkt, err := ReadPacket(conn)
	if err != nil {
		return nil, 0, err
	}
	switch pkt[4] {
	case responseOk:
		return pkt, responseOk, nil
	case ResponseErr:
		return pkt, ResponseErr, nil
	case responseLocalinfile:
	}
	var data []byte
	data = append(data, pkt...)
	if !deprecateEOF {
		pktReader := bytes.NewReader(pkt[4:])
		columns, _ := ReadLenEncodedInteger(pktReader)
		toRead := int(columns) + 1
		for i := 0; i < toRead; i++ {
			pkt, err := ReadPacket(conn)
			if err != nil {
				return nil, 0, err
			}
			data = append(data, pkt...)
		}
	}
	for {
		pkt, err := ReadPacket(conn)
		if err != nil {
			return nil, 0, err
		}
		data = append(data, pkt...)
		if pkt[4] == responseEOF {
			break
		}
	}
	return data, responseResultset, nil
}
ReadResponse reads the response
package protocol
import (
	"bytes"
	"encoding/binary"
	"io"
	"net"
)
type ConnSettings struct {
	ClientCapabilities uint32
	ServerCapabilities uint32
	SelectedDb         string
}
func (h *ConnSettings) DeprecateEOFSet() bool {
	return ((ClientDeprecateEOF & h.ServerCapabilities) != 0) &&
		((ClientDeprecateEOF & h.ClientCapabilities) != 0)
}
func ProcessHandshake(client net.Conn, mysql net.Conn) (*HandshakeV10, *HandshakeResponse41, error) {
	packet, err := ProxyPacket(mysql, client)
	if err != nil {
		println(err.Error())
		return nil, nil, err
	}
	serverHandshake, err := UnpackHandshakeV10(packet)
	if err != nil {
		println(err.Error())
		return nil, nil, err
	}
	packet, err = ProxyPacket(client, mysql)
	if err != nil {
		println(err.Error())
		return nil, nil, err
	}
	clientHandshake, err := UnpackHandshakeResponse41(packet)
	if err != nil {
		println(err.Error())
		return nil, nil, err
	}
	if _, err = ProxyPacket(mysql, client); err != nil {
		println(err.Error())
		return nil, nil, err
	}
	return serverHandshake, clientHandshake, nil
}
func ReadPrepareResponse(conn net.Conn) ([]byte, byte, error) {
	pkt, err := ReadPacket(conn)
	if err != nil {
		return nil, 0, err
	}
	switch pkt[4] {
	case responsePrepareOk:
		numParams := binary.LittleEndian.Uint16(pkt[9:11])
		numColumns := binary.LittleEndian.Uint16(pkt[11:13])
		packetsExpected := 0
		if numParams > 0 {
			packetsExpected += int(numParams) + 1
		}
		if numColumns > 0 {
			packetsExpected += int(numColumns) + 1
		}
		var data []byte
		var eofCnt int
		data = append(data, pkt...)
		for i := 1; i <= packetsExpected; i++ {
			eofCnt++
			pkt, err = ReadPacket(conn)
			if err != nil {
				return nil, 0, err
			}
			data = append(data, pkt...)
		}
		return data, responseOk, nil
	case ResponseErr:
		return pkt, ResponseErr, nil
	}
	return nil, 0, nil
}
func ReadErrMessage(errPacket []byte) string {
	return string(errPacket[13:])
}
func ReadShowFieldsResponse(conn net.Conn) ([]byte, byte, error) {
	return ReadResponse(conn, true)
}