重命名包 client 为 edge;重命名包 server 为 gateway

This commit is contained in:
2025-05-16 17:04:03 +08:00
parent 22f3c37478
commit 20ac7dbd91
37 changed files with 65 additions and 75 deletions

View File

@@ -0,0 +1,32 @@
package handlers
import (
"github.com/gofiber/fiber/v2"
"proxy-server/gateway/app"
"proxy-server/gateway/core"
)
type AuthReq struct {
Port uint16 `json:"port"`
core.Permit
}
func Auth(ctx *fiber.Ctx) (err error) {
// 安全验证
var sec core.SecuredReq
if err := ctx.BodyParser(&sec); err != nil {
return err
}
// 获取请求参数
req, err := core.Decrypt[AuthReq](&sec, app.PlatformSecret)
if err != nil {
return err
}
// 保存授权配置
app.Permits.Store(req.Port, &req.Permit)
return nil
}