mirror of
https://github.com/alireza0/x-ui.git
synced 2026-06-28 03:30:48 +00:00
63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type XUIController struct {
|
|
BaseController
|
|
|
|
inboundController *InboundController
|
|
outboundController *OutboundController
|
|
routingRuleController *RoutingRuleController
|
|
settingController *SettingController
|
|
xraySettingController *XraySettingController
|
|
}
|
|
|
|
func NewXUIController(g *gin.RouterGroup) *XUIController {
|
|
a := &XUIController{}
|
|
a.initRouter(g)
|
|
return a
|
|
}
|
|
|
|
func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
|
g = g.Group("/xui")
|
|
g.Use(a.checkLogin)
|
|
|
|
g.GET("/", a.index)
|
|
g.GET("/inbounds", a.inbounds)
|
|
g.GET("/outbounds", a.outbounds)
|
|
g.GET("/routing", a.routingRules)
|
|
g.GET("/settings", a.settings)
|
|
g.GET("/xray", a.xraySettings)
|
|
|
|
a.inboundController = NewInboundController(g)
|
|
a.outboundController = NewOutboundController(g)
|
|
a.routingRuleController = NewRoutingRuleController(g)
|
|
a.settingController = NewSettingController(g)
|
|
a.xraySettingController = NewXraySettingController(g)
|
|
}
|
|
|
|
func (a *XUIController) index(c *gin.Context) {
|
|
html(c, "index.html", "pages.index.title", nil)
|
|
}
|
|
|
|
func (a *XUIController) inbounds(c *gin.Context) {
|
|
html(c, "inbounds.html", "pages.inbounds.title", nil)
|
|
}
|
|
|
|
func (a *XUIController) outbounds(c *gin.Context) {
|
|
html(c, "outbounds.html", "pages.outbounds.title", nil)
|
|
}
|
|
|
|
func (a *XUIController) routingRules(c *gin.Context) {
|
|
html(c, "routing_rules.html", "pages.routingRules.title", nil)
|
|
}
|
|
|
|
func (a *XUIController) settings(c *gin.Context) {
|
|
html(c, "settings.html", "pages.settings.title", nil)
|
|
}
|
|
|
|
func (a *XUIController) xraySettings(c *gin.Context) {
|
|
html(c, "xray.html", "pages.xray.title", nil)
|
|
}
|