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

api.go « controller « web - github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 607dd83a9c83ce22a9ba3ac8a84cc0bc8977b379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package controller

import "github.com/gin-gonic/gin"

type APIController struct {
	BaseController
	inboundController *InboundController
}

func NewAPIController(g *gin.RouterGroup) *APIController {
	a := &APIController{}
	a.initRouter(g)
	return a
}

func (a *APIController) initRouter(g *gin.RouterGroup) {
	g = g.Group("/panel/api/inbounds")
	g.Use(a.checkLogin)

	g.GET("/list", a.getAllInbounds)
	g.GET("/get/:id", a.getSingleInbound)
	g.GET("/getClientTraffics/:email", a.getClientTraffics)
	g.POST("/add", a.addInbound)
	g.POST("/del/:id", a.delInbound)
	g.POST("/update/:id", a.updateInbound)
	g.POST("/clientIps/:email", a.getClientIps)
	g.POST("/clearClientIps/:email", a.clearClientIps)
	g.POST("/addClient", a.addInboundClient)
	g.POST("/:id/delClient/:clientId", a.delInboundClient)
	g.POST("/updateClient/:clientId", a.updateInboundClient)
	g.POST("/:id/resetClientTraffic/:email", a.resetClientTraffic)
	g.POST("/resetAllTraffics", a.resetAllTraffics)
	g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics)
	g.POST("/delDepletedClients/:id", a.delDepletedClients)

	a.inboundController = NewInboundController(g)
}

func (a *APIController) getAllInbounds(c *gin.Context) {
	a.inboundController.getInbounds(c)
}

func (a *APIController) getSingleInbound(c *gin.Context) {
	a.inboundController.getInbound(c)
}

func (a *APIController) getClientTraffics(c *gin.Context) {
	a.inboundController.getClientTraffics(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)
}

func (a *APIController) getClientIps(c *gin.Context) {
	a.inboundController.getClientIps(c)
}

func (a *APIController) clearClientIps(c *gin.Context) {
	a.inboundController.clearClientIps(c)
}

func (a *APIController) addInboundClient(c *gin.Context) {
	a.inboundController.addInboundClient(c)
}

func (a *APIController) delInboundClient(c *gin.Context) {
	a.inboundController.delInboundClient(c)
}

func (a *APIController) updateInboundClient(c *gin.Context) {
	a.inboundController.updateInboundClient(c)
}

func (a *APIController) resetClientTraffic(c *gin.Context) {
	a.inboundController.resetClientTraffic(c)
}

func (a *APIController) resetAllTraffics(c *gin.Context) {
	a.inboundController.resetAllTraffics(c)
}

func (a *APIController) resetAllClientTraffics(c *gin.Context) {
	a.inboundController.resetAllClientTraffics(c)
}

func (a *APIController) delDepletedClients(c *gin.Context) {
	a.inboundController.delDepletedClients(c)
}