This commit is contained in:
Gnarwhal 2024-10-02 05:54:34 +00:00
parent 83f4fbde7f
commit 3523f1cf4e
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174

View file

@ -31,6 +31,7 @@ import (
type SMTPSession struct {
connection net.Conn
host string
buffer [4096]byte
ReversePathBuffer *string
ForwardPathBuffer []string
@ -38,10 +39,8 @@ type SMTPSession struct {
func MakeSMTPSession(connection net.Conn, host string) SMTPSession {
return SMTPSession{
connection,
host,
nil,
[]string{},
connection: connection,
host: host,
}
}
@ -103,15 +102,14 @@ func (self *SMTPSession) TraceSession(direction string, message string) {
}
var buffer = [1024]byte{}
func (self *SMTPSession) Read(delimiter string) (string, error) {
var message string
for !strings.Contains(message, delimiter) {
num_read, err := self.connection.Read(buffer[:])
num_read, err := self.connection.Read(self.buffer[:])
if err != nil {
return "", err
}
message += string(buffer[:num_read])
message += string(self.buffer[:num_read])
}
self.TraceSession(" ->", message)