code cleanup
This commit is contained in:
parent
0a86ef3e98
commit
bdf97ed42a
17
main.go
17
main.go
@ -147,20 +147,6 @@ func handleConnection(clientConn net.Conn) {
|
||||
smtp.client.Write([]byte("501 Syntax error in parameters or arguments\r\n"))
|
||||
return
|
||||
}
|
||||
|
||||
// email := strings.Trim(strings.TrimSpace(parts[1]), "<>")
|
||||
// domain := strings.Split(email, "@")
|
||||
// if len(domain) != 2 {
|
||||
// smtp.client.Write([]byte("501 Syntax error in parameters or arguments\r\n"))
|
||||
// return
|
||||
// }
|
||||
// fmt.Sscanf(parts[1], "<%s>%s", &email, &whatever)
|
||||
// email := re.FindStringSubmatch(parts[1])
|
||||
// if len(email) < 1 {
|
||||
// log.Errorf("%s is not email address", email[1])
|
||||
// return
|
||||
// }
|
||||
// domain := strings.Split(email[0], "@")
|
||||
start := strings.Index(parts[1], "<")
|
||||
end := strings.Index(parts[1], ">")
|
||||
if start == -1 || end == -1 || start >= end {
|
||||
@ -187,7 +173,7 @@ func handleConnection(clientConn net.Conn) {
|
||||
log.Warnf("Disconnecting %s - attempted DATA without valid recipient", smtp.clientAddr)
|
||||
return
|
||||
}
|
||||
//Otherwise Forward to target and get response
|
||||
// Otherwise Forward to target and get response
|
||||
smtp.target.Write([]byte(line))
|
||||
n, err := smtp.target.Read(response)
|
||||
if err != nil {
|
||||
@ -215,7 +201,6 @@ func handleConnection(clientConn net.Conn) {
|
||||
}
|
||||
}()
|
||||
|
||||
// 从服务器到客户端
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
if _, err := io.Copy(smtp.client, smtp.target); err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user