From 7ffed0f738fd8ab73538bdf69422a70701087e6f Mon Sep 17 00:00:00 2001 From: luorijun Date: Tue, 13 May 2025 18:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E5=BB=BA=E7=AB=8B=E6=B5=81=E7=A8=8B=E5=9B=BE=E6=96=87?= =?UTF-8?q?=E6=A1=A3=EF=BC=8C=E4=BC=98=E5=8C=96=E8=BE=B9=E7=BC=98=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=92=8C=E4=BB=A3=E7=90=86=E6=9C=8D=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/服务网络建立流程图.excalidraw | 876 +++++++++++++++++++++++++++++ web/handlers/edge.go | 27 +- web/handlers/proxy.go | 10 +- web/router.go | 5 + 4 files changed, 905 insertions(+), 13 deletions(-) create mode 100644 docs/服务网络建立流程图.excalidraw diff --git a/docs/服务网络建立流程图.excalidraw b/docs/服务网络建立流程图.excalidraw new file mode 100644 index 0000000..201ca8f --- /dev/null +++ b/docs/服务网络建立流程图.excalidraw @@ -0,0 +1,876 @@ +{ + "type": "excalidraw", + "version": 2, + "source": "https://excalidraw.com", + "elements": [ + { + "id": "zsbeHr3kNPUaSvPMU-OMT", + "type": "rectangle", + "x": 583, + "y": 200, + "width": 116.99999999999997, + "height": 400, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a0", + "roundness": { + "type": 3 + }, + "seed": 277020470, + "version": 77, + "versionNonce": 280720234, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "WZRxUygjSWpwJ9jCQGz64" + } + ], + "updated": 1747132847296, + "link": null, + "locked": false + }, + { + "id": "WZRxUygjSWpwJ9jCQGz64", + "type": "text", + "x": 600.8700256347656, + "y": 387.5, + "width": 81.25994873046875, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a1", + "roundness": null, + "seed": 687766762, + "version": 67, + "versionNonce": 1888319018, + "isDeleted": false, + "boundElements": [], + "updated": 1747132847296, + "link": null, + "locked": false, + "text": "platform", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "zsbeHr3kNPUaSvPMU-OMT", + "originalText": "platform", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "h_Vq2Fw7X05jQmOjpvwdp", + "type": "rectangle", + "x": 1200, + "y": 200, + "width": 200.00000000000003, + "height": 100, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a2", + "roundness": { + "type": 3 + }, + "seed": 535145962, + "version": 47, + "versionNonce": 1571657718, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "PCRc2tKqmXazgf7vBXpBy" + } + ], + "updated": 1747132544466, + "link": null, + "locked": false + }, + { + "id": "PCRc2tKqmXazgf7vBXpBy", + "type": "text", + "x": 1273.8300247192383, + "y": 237.5, + "width": 52.33995056152344, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a3", + "roundness": null, + "seed": 1744934570, + "version": 32, + "versionNonce": 1978592246, + "isDeleted": false, + "boundElements": [], + "updated": 1747132358707, + "link": null, + "locked": false, + "text": "fwd...", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "h_Vq2Fw7X05jQmOjpvwdp", + "originalText": "fwd...", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "zNdFfRSAyIRsYWkHi09yH", + "type": "rectangle", + "x": 1201.152228201041, + "y": 500, + "width": 200, + "height": 100, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a4", + "roundness": { + "type": 3 + }, + "seed": 1960286698, + "version": 110, + "versionNonce": 236636202, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "3DEBFPuFoQqTfJaMlPRtU" + } + ], + "updated": 1747132546398, + "link": null, + "locked": false + }, + { + "id": "3DEBFPuFoQqTfJaMlPRtU", + "type": "text", + "x": 1270.5922535306308, + "y": 537.5, + "width": 61.11994934082031, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a5", + "roundness": null, + "seed": 1536135146, + "version": 109, + "versionNonce": 58765174, + "isDeleted": false, + "boundElements": [], + "updated": 1747132520694, + "link": null, + "locked": false, + "text": "edge...", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "zNdFfRSAyIRsYWkHi09yH", + "originalText": "edge...", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "FaY6s3IeRlUKxMRwPzXX4", + "type": "arrow", + "x": 1161.5263313428777, + "y": 201.7402520552557, + "width": 420, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a6", + "roundness": { + "type": 2 + }, + "seed": 1025214378, + "version": 267, + "versionNonce": 650402614, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "iCHZyeKUHerPacOJtYeYI" + } + ], + "updated": 1747132627325, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -420, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "elbowed": false + }, + { + "id": "iCHZyeKUHerPacOJtYeYI", + "type": "text", + "x": 894.7183479444402, + "y": 191.7402520552557, + "width": 113.615966796875, + "height": 20, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a6V", + "roundness": null, + "seed": 118902262, + "version": 27, + "versionNonce": 781320938, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957440, + "link": null, + "locked": false, + "text": "1. 注册转发服务", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "FaY6s3IeRlUKxMRwPzXX4", + "originalText": "1. 注册转发服务", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "po3Veg6YDVvp2KXkFaFuS", + "type": "arrow", + "x": 1161.152228201041, + "y": 520.5986727826297, + "width": 420, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a7", + "roundness": { + "type": 2 + }, + "seed": 910967926, + "version": 493, + "versionNonce": 1269815542, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "6vSZb4yswl2PqEOZHsbfY" + } + ], + "updated": 1747132667478, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -420, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "elbowed": false + }, + { + "id": "6vSZb4yswl2PqEOZHsbfY", + "type": "text", + "x": 892.896239126334, + "y": 510.5986727826297, + "width": 116.51197814941406, + "height": 20, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a7V", + "roundness": null, + "seed": 781601642, + "version": 36, + "versionNonce": 1701769718, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957441, + "link": null, + "locked": false, + "text": "3. 注册边缘节点", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "po3Veg6YDVvp2KXkFaFuS", + "originalText": "3. 注册边缘节点", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "BNs2GbrhDdzbMBJzAWdwv", + "type": "arrow", + "x": 1300, + "y": 460, + "width": 0, + "height": 120, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a8", + "roundness": { + "type": 2 + }, + "seed": 799286378, + "version": 309, + "versionNonce": 925925802, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "Kx-Zgee6eTpVb7Mgq6W9S" + } + ], + "updated": 1747132974134, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 0, + -120 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "elbowed": false + }, + { + "id": "Kx-Zgee6eTpVb7Mgq6W9S", + "type": "text", + "x": 1217.6640167236328, + "y": 380, + "width": 164.67196655273438, + "height": 40, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a8V", + "roundness": null, + "seed": 1451839658, + "version": 66, + "versionNonce": 1319645994, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957442, + "link": null, + "locked": false, + "text": "5. 边缘节点连接到转发\n服务", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "BNs2GbrhDdzbMBJzAWdwv", + "originalText": "5. 边缘节点连接到转发服务", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "mFDQoiG3vbpyFwQBC7jyG", + "type": "rectangle", + "x": 198, + "y": 351, + "width": 200, + "height": 100, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a9", + "roundness": { + "type": 3 + }, + "seed": 1351484214, + "version": 37, + "versionNonce": 1265028342, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "5y_lj25Q01lH09VvtpEee" + } + ], + "updated": 1747132838847, + "link": null, + "locked": false + }, + { + "id": "5y_lj25Q01lH09VvtpEee", + "type": "text", + "x": 277.6000213623047, + "y": 388.5, + "width": 40.799957275390625, + "height": 25, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "a9V", + "roundness": null, + "seed": 1682566506, + "version": 28, + "versionNonce": 1110294070, + "isDeleted": false, + "boundElements": [], + "updated": 1747132838847, + "link": null, + "locked": false, + "text": "user", + "fontSize": 20, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "mFDQoiG3vbpyFwQBC7jyG", + "originalText": "user", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "gcvXDtgBKjckbIcfsDhkr", + "type": "arrow", + "x": 423, + "y": 399, + "width": 129, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aA", + "roundness": { + "type": 2 + }, + "seed": 1116663094, + "version": 209, + "versionNonce": 1517628458, + "isDeleted": false, + "boundElements": [], + "updated": 1747132848563, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 129, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": null, + "endArrowhead": "arrow", + "elbowed": false + }, + { + "id": "i_8u5473xh1b8I_yoY07j", + "type": "arrow", + "x": 1160.743274975568, + "y": 241.59697448672608, + "width": 420, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aB", + "roundness": { + "type": 2 + }, + "seed": 1331335734, + "version": 72, + "versionNonce": 624254710, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "hfpuERsbfPQwM7YecmMfg" + } + ], + "updated": 1747132629207, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -420, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": "arrow", + "endArrowhead": null, + "elbowed": false + }, + { + "id": "hfpuERsbfPQwM7YecmMfg", + "type": "text", + "x": 888.3272974975407, + "y": 231.59697448672608, + "width": 124.83195495605469, + "height": 20, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aBV", + "roundness": null, + "seed": 127815402, + "version": 26, + "versionNonce": 772697526, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957442, + "link": null, + "locked": false, + "text": "2. 平台返回 200", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "i_8u5473xh1b8I_yoY07j", + "originalText": "2. 平台返回 200", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "PjDN6opphck2HkSYTe1Ln", + "type": "arrow", + "x": 1159.5713063315768, + "y": 581.2037355477607, + "width": 420, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aE", + "roundness": { + "type": 2 + }, + "seed": 1407186474, + "version": 38, + "versionNonce": 580002102, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "2qs1YbvHnFM3og-O2ZoRa" + } + ], + "updated": 1747132598748, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + -420, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": "arrow", + "endArrowhead": null, + "elbowed": false + }, + { + "id": "2qs1YbvHnFM3og-O2ZoRa", + "type": "text", + "x": 875.4993229941745, + "y": 571.2037355477607, + "width": 148.1439666748047, + "height": 20, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aF", + "roundness": null, + "seed": 983535734, + "version": 71, + "versionNonce": 1835696502, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957442, + "link": null, + "locked": false, + "text": "4. 平台分配转发服务", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "PjDN6opphck2HkSYTe1Ln", + "originalText": "4. 平台分配转发服务", + "autoResize": true, + "lineHeight": 1.25 + }, + { + "id": "8AtKcV9AvqUvk2Mr9flrI", + "type": "arrow", + "x": 740, + "y": 280, + "width": 420, + "height": 0, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aH", + "roundness": { + "type": 2 + }, + "seed": 1080875126, + "version": 25, + "versionNonce": 1872649834, + "isDeleted": false, + "boundElements": [ + { + "type": "text", + "id": "sZja5umzjfTmtuZDk_hsS" + } + ], + "updated": 1747132657373, + "link": null, + "locked": false, + "points": [ + [ + 0, + 0 + ], + [ + 420, + 0 + ] + ], + "lastCommittedPoint": null, + "startBinding": null, + "endBinding": null, + "startArrowhead": "arrow", + "endArrowhead": null, + "elbowed": false + }, + { + "id": "sZja5umzjfTmtuZDk_hsS", + "type": "text", + "x": 859.4880142211914, + "y": 270, + "width": 181.0239715576172, + "height": 20, + "angle": 0, + "strokeColor": "#1e1e1e", + "backgroundColor": "transparent", + "fillStyle": "solid", + "strokeWidth": 2, + "strokeStyle": "solid", + "roughness": 1, + "opacity": 100, + "groupIds": [], + "frameId": null, + "index": "aI", + "roundness": null, + "seed": 705278454, + "version": 41, + "versionNonce": 1536576426, + "isDeleted": false, + "boundElements": null, + "updated": 1747132957443, + "link": null, + "locked": false, + "text": "6. 转发服务更新端口信息", + "fontSize": 16, + "fontFamily": 5, + "textAlign": "center", + "verticalAlign": "middle", + "containerId": "8AtKcV9AvqUvk2Mr9flrI", + "originalText": "6. 转发服务更新端口信息", + "autoResize": true, + "lineHeight": 1.25 + } + ], + "appState": { + "gridSize": 20, + "gridStep": 5, + "gridModeEnabled": false, + "viewBackgroundColor": "#ffffff" + }, + "files": {} +} \ No newline at end of file diff --git a/web/handlers/edge.go b/web/handlers/edge.go index 3c11b6f..f156d03 100644 --- a/web/handlers/edge.go +++ b/web/handlers/edge.go @@ -1,20 +1,23 @@ package handlers import ( - "github.com/gofiber/fiber/v2" - "gorm.io/gen/field" + edge2 "platform/web/domains/edge" proxy2 "platform/web/domains/proxy" g "platform/web/globals" m "platform/web/models" q "platform/web/queries" + + "github.com/gofiber/fiber/v2" + "gorm.io/gen/field" + "gorm.io/gorm/clause" ) type RegisterEdgeReq struct { - Name int `json:"name" validate:"required"` - Version int `json:"version" validate:"required"` - ISP int `json:"isp" validate:"required"` - Prov string `json:"prov" validate:"required"` - City string `json:"city" validate:"required"` + Name string `json:"name" validate:"required"` + Version int `json:"version" validate:"required"` + ISP edge2.ISP `json:"isp"` + Prov string `json:"prov"` + City string `json:"city"` } type RegisterEdgeResp struct { @@ -44,13 +47,19 @@ func OnlineEdge(c *fiber.Ctx) (err error) { } // 保存节点信息 - err = q.Edge.Save(&m.Edge{ + err = q.Edge.Clauses(clause.OnConflict{ + UpdateAll: true, + Columns: []clause.Column{{Name: "name"}}, + }).Create(&m.Edge{ + Name: req.Name, Version: int32(req.Version), - Host: c.IP(), + Host: c.Context().RemoteIP().String(), Isp: int32(req.ISP), Prov: req.Prov, City: req.City, ProxyID: fwd.ID, + Type: int32(edge2.TypeSelfHosted), + Status: 1, }) if err != nil { return err diff --git a/web/handlers/proxy.go b/web/handlers/proxy.go index 122b55a..2b7a2c0 100644 --- a/web/handlers/proxy.go +++ b/web/handlers/proxy.go @@ -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, }) diff --git a/web/router.go b/web/router.go index 6709d4a..050d34a 100644 --- a/web/router.go +++ b/web/router.go @@ -71,4 +71,9 @@ func ApplyRouters(app *fiber.App) { // 节点 edge := api.Group("/edge") edge.Post("/online", handlers.OnlineEdge) + + // 临时 + app.Get("/test", func(c *fiber.Ctx) error { + return c.JSON(c.GetReqHeaders()) + }) }