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 <mc.sanaei@gmail.com>2023-02-09 22:18:06 +0300
committerMHSanaei <mc.sanaei@gmail.com>2023-02-09 22:18:06 +0300
commitb73e4173a3c1e69e02ad6b4e3b43e425e57a5be9 (patch)
treed95d2f5e903d97082e11eb9f9023c165b1bde388 /web/controller/api.go
3x-ui
Diffstat (limited to 'web/controller/api.go')
-rw-r--r--web/controller/api.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/web/controller/api.go b/web/controller/api.go
new file mode 100644
index 00000000..84ac9c20
--- /dev/null
+++ b/web/controller/api.go
@@ -0,0 +1,48 @@
+package controller
+
+import (
+ "github.com/gin-gonic/gin"
+)
+type APIController struct {
+ BaseController
+
+ inboundController *InboundController
+ settingController *SettingController
+}
+
+func NewAPIController(g *gin.RouterGroup) *APIController {
+ a := &APIController{}
+ a.initRouter(g)
+ return a
+}
+
+func (a *APIController) initRouter(g *gin.RouterGroup) {
+ g = g.Group("/xui/API/inbounds")
+ g.Use(a.checkLogin)
+
+ g.GET("/", a.inbounds)
+ g.GET("/get/:id", a.inbound)
+ g.POST("/add", a.addInbound)
+ g.POST("/del/:id", a.delInbound)
+ g.POST("/update/:id", a.updateInbound)
+
+
+ a.inboundController = NewInboundController(g)
+}
+
+
+func (a *APIController) inbounds(c *gin.Context) {
+ a.inboundController.getInbounds(c)
+}
+func (a *APIController) inbound(c *gin.Context) {
+ a.inboundController.getInbound(c)
+}
+func (a *APIController) addInbound(c *gin.Context) {
+ a.inboundController.addInbound(c)
+}
+func (a *APIController) delInbound(c *gin.Context) {
+ a.inboundController.delInbound(c)
+}
+func (a *APIController) updateInbound(c *gin.Context) {
+ a.inboundController.updateInbound(c)
+}