Decode basic milter packet structure
This commit is contained in:
parent
19e4cf14ae
commit
41b78f0b58
|
@ -1 +1,5 @@
|
|||
# Ignore .vagrant folder
|
||||
.vagrant
|
||||
|
||||
# Ignore build result
|
||||
milter-experiment
|
||||
|
|
11
main.go
11
main.go
|
@ -34,6 +34,17 @@ func handleMtaConnection(clientConnection *bufio.ReadWriter) {
|
|||
logger.Errorln(err.Error())
|
||||
}
|
||||
logger.Debugf("Parsed length: %d\n", packetLength)
|
||||
|
||||
// Next up is a character, indicating the milter command
|
||||
logger.Debugf("Parsing command from byte: %X\n", buf[4])
|
||||
command := string(buf[4])
|
||||
logger.Debugf("Parsed packet command: %s\n", command)
|
||||
|
||||
// Last part is data with lenght len-1
|
||||
data := make([]byte, packetLength)
|
||||
data = buf[5 : 5+packetLength-1]
|
||||
logger.Debugf("Hexdump of packet payload read:\n%s", hex.Dump(data))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue