]> 127.0.0.1 Git - part/.git/commitdiff
1 v0.28.20231209062226
authorqydysky <qydysky@foxmail.com>
Sat, 9 Dec 2023 06:19:07 +0000 (14:19 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 9 Dec 2023 06:19:07 +0000 (14:19 +0800)
log/Log.go
web/Web.go

index a46ab78dd9a780d2dd6e23f045071f66a18664fc..da8570a9ac1d5a1708460ec220b865db4400ee96 100644 (file)
@@ -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...)
+}
index 7ff9c6cd672ba8cad30ee640b8a897a8b9ca2637..e7716a8fde59709aede25c002380411c1b0cda94 100644 (file)
@@ -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)