diff options
author | Runxi Yu <me@runxiyu.org> | 2025-01-02 19:30:51 +0000 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-01-02 19:30:51 +0000 |
commit | 00f3cb9fb48cfb9768b695bd0d9eb8367ad84782 (patch) | |
tree | 2e35b4252b2538c7dbe13d90b501216ded240149 /main.go | |
parent | File splitting (diff) | |
download | maild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.tar.gz maild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.tar.zst maild-00f3cb9fb48cfb9768b695bd0d9eb8367ad84782.zip |
Deliver to inbox
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -3,21 +3,18 @@ package main import ( "bufio" "net" - "os" + "flag" + "errors" + "io" "go.lindenii.runxiyu.org/lindenii-common/clog" - "go.lindenii.runxiyu.org/lindenii-common/scfg" ) const VERSION = "lindenii-maild v0.0.0" func main() { - config_file, err := os.Open("maild.scfg") - if err != nil { - panic(err) - } - - err = scfg.NewDecoder(bufio.NewReader(config_file)).Decode(&config) + config_path := flag.String("config", "maild.scfg", "path to configuration file") + err := load_config(*config_path) if err != nil { panic(err) } @@ -36,7 +33,7 @@ func main() { go func() { err := handle_incoming_server_connection(bufio.NewReader(conn), bufio.NewWriter(conn)) - if err != nil { + if err != nil && !errors.Is(err, io.EOF) { clog.Error("connection handler returned error", "err", err) } }() |