提供一个测试注册代理接口
This commit is contained in:
@@ -1,11 +1,38 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/netip"
|
||||
"platform/pkg/env"
|
||||
g "platform/web/globals"
|
||||
s "platform/web/services"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func DebugRegisterProxyBaiYin(c *fiber.Ctx) error {
|
||||
if env.RunMode != env.RunModeDev {
|
||||
return fiber.ErrNotFound
|
||||
}
|
||||
|
||||
ok, err := g.Redis.SetNX(c.Context(), "debug:channel:register:127.0.0.1", true, 0).Result()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
slog.Info("注册代理", "ok", ok)
|
||||
if !ok {
|
||||
return fiber.ErrConflict
|
||||
}
|
||||
|
||||
err = s.Proxy.RegisterBaiyin("1a:2b:3c:4d:5e:6f", netip.AddrFrom4([4]byte{127, 0, 0, 1}), "test", "test")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// region 报告上线
|
||||
|
||||
type ProxyReportOnlineReq struct {
|
||||
@@ -123,8 +150,6 @@ func ProxyReportOnline(c *fiber.Ctx) (err error) {
|
||||
// })
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region 报告下线
|
||||
|
||||
type ProxyReportOfflineReq struct {
|
||||
@@ -168,8 +193,6 @@ func ProxyReportOffline(c *fiber.Ctx) (err error) {
|
||||
// return nil
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region 报告更新
|
||||
|
||||
type ProxyReportUpdateReq struct {
|
||||
@@ -335,8 +358,6 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
|
||||
// return nil
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
type ProxyPermit struct {
|
||||
Id int32 `json:"id"`
|
||||
Expire time.Time `json:"expire"`
|
||||
|
||||
Reference in New Issue
Block a user