Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-01-11 09:27:21 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-01-11 09:27:21 +0300
commitbee690429f5a5a4639679236b414d42dbdd6b762 (patch)
tree0134c71ef87a417f9dc32bec6bdb1e9530c13c3a /web/controller
parent2111632702ad8b370bf3dc224b40f0c7385001ab (diff)
WARP via wireguard
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/xray_setting.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/web/controller/xray_setting.go b/web/controller/xray_setting.go
index d4deacd9..09e9115f 100644
--- a/web/controller/xray_setting.go
+++ b/web/controller/xray_setting.go
@@ -26,6 +26,7 @@ func (a *XraySettingController) initRouter(g *gin.RouterGroup) {
g.POST("/update", a.updateSetting)
g.GET("/getXrayResult", a.getXrayResult)
g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig)
+ g.POST("/warp/:action", a.warp)
}
func (a *XraySettingController) getXraySetting(c *gin.Context) {
@@ -61,3 +62,25 @@ func (a *XraySettingController) getDefaultXrayConfig(c *gin.Context) {
func (a *XraySettingController) getXrayResult(c *gin.Context) {
jsonObj(c, a.XrayService.GetXrayResult(), nil)
}
+
+func (a *XraySettingController) warp(c *gin.Context) {
+ action := c.Param("action")
+ var resp string
+ var err error
+ switch action {
+ case "data":
+ resp, err = a.XraySettingService.GetWarp()
+ case "config":
+ resp, err = a.XraySettingService.GetWarpConfig()
+ case "reg":
+ skey := c.PostForm("privateKey")
+ pkey := c.PostForm("publicKey")
+ resp, err = a.XraySettingService.RegWarp(skey, pkey)
+ case "license":
+ license := c.PostForm("license")
+ println(license)
+ resp, err = a.XraySettingService.SetWarpLicence(license)
+ }
+
+ jsonObj(c, resp, err)
+}