From 79efc9efa2a6af365ec440c50be1ab212602aecc Mon Sep 17 00:00:00 2001 From: qydysky Date: Sat, 9 Dec 2023 14:19:07 +0800 Subject: [PATCH] 1 --- log/Log.go | 13 +++++++++++++ web/Web.go | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/log/Log.go b/log/Log.go index a46ab78..da8570a 100644 --- a/log/Log.go +++ b/log/Log.go @@ -184,3 +184,16 @@ func (I *Log_interface) L(prefix string, i ...any) (O *Log_interface) { }) return } + +func (I *Log_interface) Debug(msg string, args ...any) { + I.L(msg, args...) +} +func (I *Log_interface) Info(msg string, args ...any) { + I.L(msg, args...) +} +func (I *Log_interface) Warn(msg string, args ...any) { + I.L(msg, args...) +} +func (I *Log_interface) Error(msg string, args ...any) { + I.L(msg, args...) +} diff --git a/web/Web.go b/web/Web.go index 7ff9c6c..e7716a8 100644 --- a/web/Web.go +++ b/web/Web.go @@ -2,6 +2,7 @@ package part import ( "context" + "crypto/tls" "net" "net/http" "strconv" @@ -69,7 +70,14 @@ func NewSyncMap(conf *http.Server, m *WebPath, matchFunc ...func(path string) (f matchFunc = append(matchFunc, o.wrs.Load) - go o.Server.ListenAndServe() + ln, err := net.Listen("tcp", conf.Addr) + if err != nil { + panic(err) + } + if conf.TLSConfig != nil { + ln = tls.NewListener(ln, conf.TLSConfig) + } + go o.Server.Serve(ln) o.mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { f, ok := matchFunc[0](r.URL.Path) -- 2.39.2