aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--main.go12
3 files changed, 11 insertions, 7 deletions
diff --git a/go.mod b/go.mod
index 291ff38..2ff8d98 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.23.4
require (
github.com/jackc/pgx/v5 v5.7.2
- go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250111202249-35d69905e2fc
+ go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250113062520-2daa71bfa256
)
require (
diff --git a/go.sum b/go.sum
index 4ee8046..2be52d7 100644
--- a/go.sum
+++ b/go.sum
@@ -16,8 +16,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250111202249-35d69905e2fc h1:jYjxxslcbZSKmXT96FhRW//t0dx9LN54J4PeD6oXTQk=
-go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250111202249-35d69905e2fc/go.mod h1:bOxuuGXA3UpbLb1lKohr2j2MVcGGLcqfAprGx9VCkMA=
+go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250113062520-2daa71bfa256 h1:LCekcmEfZRfuuLMKUMT2TCgdXQRPIjxalibQIzHjzIo=
+go.lindenii.runxiyu.org/lindenii-common v0.0.0-20250113062520-2daa71bfa256/go.mod h1:bOxuuGXA3UpbLb1lKohr2j2MVcGGLcqfAprGx9VCkMA=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
diff --git a/main.go b/main.go
index f1c28ba..bf503f4 100644
--- a/main.go
+++ b/main.go
@@ -18,27 +18,31 @@ func main() {
err := load_config(*config_path)
if err != nil {
- panic(err)
+ clog.Fatal(1, "Configuration file not found at "+*config_path)
}
listener, err := net.Listen(config.MX.Net, config.MX.Addr)
if err != nil {
- panic(err)
+ clog.Fatal(1, "MX: Cannot listen: "+err.Error())
}
defer listener.Close()
+ clog.Info("MX: Listening via " + config.MX.Net + " on " + config.MX.Addr)
for {
conn, err := listener.Accept()
if err != nil {
- panic(err)
+ clog.Error("MX: Cannot accept connection: "+err.Error())
}
+ clog.Info("MX: Accepted connection from " + conn.RemoteAddr().String())
go func() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err := handle_mx_recv_conn(ctx, conn)
if err != nil && !errors.Is(err, io.EOF) {
- clog.Error("connection handler returned error", "err", err)
+ clog.Error("MX: Connection handler for " + conn.RemoteAddr().String() + " returned error: " + err.Error())
+ } else {
+ clog.Error("MX: Connection handler for " + conn.RemoteAddr().String() + " returned error: " + err.Error())
}
}()
}