This commit is contained in:
shoopea 2020-06-14 22:20:19 +02:00
parent fc76b1eeab
commit db63390c5f

14
main.go
View File

@ -22,16 +22,21 @@ func main() {
logInfoDebug("Authentication sent (%v)", p.Bytes())
r := bufio.NewReader(conn)
b := make([]byte, 65536)
_, err := r.Read(b)
logInfoDebug("r.Read : %v", b)
/*
for {
p := Packet{}
b, err := r.ReadByte()
logErrorDebug(err, "conn.ReadByte")
logErrorDebug(err, "r.ReadByte")
p.PLength = uint16(b) << 8
b, err = r.ReadByte()
logErrorDebug(err, "conn.ReadByte")
logErrorDebug(err, "r.ReadByte")
p.PLength += uint16(b)
b, err = r.ReadByte()
logErrorDebug(err, "conn.ReadByte")
logErrorDebug(err, "r.ReadByte")
p.PType = uint8(b)
if p.PLength <= 3 {
logInfoAlert("Wrong packet length")
@ -41,7 +46,7 @@ func main() {
for {
_, err := r.Read(d[len(d):])
logErrorDebug(err, "conn.Read")
logErrorDebug(err, "r.Read")
if len(d) == int(p.PLength-3) {
break
}
@ -49,4 +54,5 @@ func main() {
logInfoDebug("Packet read : len : %d / type : %d", p.PLength, p.PType)
}
*/
}