blob: 274e9b7a05d0fe2a49916d6a4fdf0b0de1182d64 (
plain) (
tree)
|
|
package main
import (
"errors"
"flag"
"io"
"net"
"go.lindenii.runxiyu.org/lindenii-common/clog"
)
const VERSION = "lindenii-maild v0.0.0"
func main() {
config_path := flag.String("config", "/etc/lindenii/maild.scfg", "path to configuration file")
flag.Parse()
err := load_config(*config_path)
if err != nil {
panic(err)
}
listener, err := net.Listen("tcp", ":25")
if err != nil {
panic(err)
}
defer listener.Close()
for {
conn, err := listener.Accept()
if err != nil {
panic(err)
}
go func() {
err := handle_mx_recv_conn(conn)
if err != nil && !errors.Is(err, io.EOF) {
clog.Error("connection handler returned error", "err", err)
}
}()
}
}
|