diff --git a/.gitignore b/.gitignore index 0570206..2f4396f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ +# Ignore .vagrant folder +.vagrant + +# Ignore build result milter-experiment diff --git a/main.go b/main.go index 50fb88b..32ea9b4 100644 --- a/main.go +++ b/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)) + } } }