新增服务网络建立流程图文档,优化边缘节点和代理服务的注册逻辑
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"gorm.io/gorm/clause"
|
||||
"log/slog"
|
||||
auth2 "platform/web/auth"
|
||||
proxy2 "platform/web/domains/proxy"
|
||||
g "platform/web/globals"
|
||||
m "platform/web/models"
|
||||
q "platform/web/queries"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
// region OnlineProxy
|
||||
@@ -36,7 +37,8 @@ func OnlineProxy(c *fiber.Ctx) (err error) {
|
||||
}
|
||||
|
||||
// 创建代理
|
||||
slog.Debug("注册转发服务", "ip", c.IP())
|
||||
ip := c.Context().RemoteIP()
|
||||
slog.Debug("注册转发服务", "ip", ip)
|
||||
err = q.Proxy.
|
||||
Clauses(clause.OnConflict{
|
||||
UpdateAll: true,
|
||||
@@ -47,7 +49,7 @@ func OnlineProxy(c *fiber.Ctx) (err error) {
|
||||
Create(&m.Proxy{
|
||||
Name: req.Name,
|
||||
Version: int32(req.Version),
|
||||
Host: c.IP(),
|
||||
Host: ip.String(),
|
||||
Type: int32(proxy2.TypeSelfHosted),
|
||||
Status: 1,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user