feat(config): enhance NodeConfig with TrafficReportThreshold, IPStrategy, DNS, Block, and Outbound fields

This commit is contained in:
Chang lue Tsen
2025-09-28 19:05:54 +09:00
parent 64f0bcc55a
commit 0d1df5f905
14 changed files with 395 additions and 115 deletions
@@ -1,6 +1,7 @@
package server
import (
"fmt"
"net/http"
"strconv"
@@ -26,14 +27,15 @@ func QueryServerProtocolConfigHandler(svcCtx *svc.ServiceContext) func(c *gin.Co
}
req.ServerID = serverID
key := c.GetHeader("secret_key")
if key == "" || key != svcCtx.Config.Node.NodeSecret {
logger.Debugf("[QueryServerProtocolConfigHandler] - secret_key error: %s", key)
c.String(http.StatusUnauthorized, "Unauthorized")
if err = c.ShouldBindQuery(&req); err != nil {
logger.Debugf("[QueryServerProtocolConfigHandler] - ShouldBindQuery error: %v, Query: %v", err, c.Request.URL.Query())
c.String(http.StatusBadRequest, "Invalid Params")
c.Abort()
return
}
fmt.Printf("[QueryServerProtocolConfigHandler] - ShouldBindQuery request: %+v\n", req)
l := server.NewQueryServerProtocolConfigLogic(c.Request.Context(), svcCtx)
resp, err := l.QueryServerProtocolConfig(&req)
result.HttpResult(c, resp, err)