Documentation
¶
Overview ¶
Package controller provides HTTP request handlers and controllers for the l-ui web management panel. It handles routing, authentication, and API endpoints for managing Xray inbounds, settings, and more.
Index ¶
- func I18nWeb(c *gin.Context, name string, params ...string) string
- func ServeOpenAPISpec(c *gin.Context)
- func SetDistFS(fs embed.FS)
- type APIController
- type BaseController
- type ClientController
- type CustomGeoController
- type GroupController
- type InboundController
- type IndexController
- type LUIController
- type LoginForm
- type NodeController
- type ServerContext
- type ServerController
- type SettingController
- type WebSocketController
- type XraySettingController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func I18nWeb ¶
I18nWeb retrieves an internationalized message for the web interface based on the current locale.
func ServeOpenAPISpec ¶
ServeOpenAPISpec returns the generated OpenAPI 3.0 description of the panel API. Postman / Insomnia / openapi-generator consume this URL directly; the in-panel Swagger UI page also fetches it. The spec is produced at frontend build time by scripts/build-openapi.mjs and embedded into the binary via the dist FS.
Types ¶
type APIController ¶
type APIController struct {
BaseController
Tgbot service.Tgbot
// contains filtered or unexported fields
}
APIController handles the main API routes for the l-ui panel, including inbounds and server management.
func NewAPIController ¶
func NewAPIController(g *gin.RouterGroup, customGeo *service.CustomGeoService) *APIController
NewAPIController creates a new APIController instance and initializes its routes.
func (*APIController) BackuptoTgbot ¶
func (a *APIController) BackuptoTgbot(c *gin.Context)
BackuptoTgbot sends a backup of the panel data to Telegram bot admins.
type BaseController ¶
type BaseController struct{}
BaseController provides common functionality for all controllers, including authentication checks.
type ClientController ¶
type ClientController struct {
// contains filtered or unexported fields
}
func NewClientController ¶
func NewClientController(g *gin.RouterGroup) *ClientController
type CustomGeoController ¶
type CustomGeoController struct {
BaseController
// contains filtered or unexported fields
}
func NewCustomGeoController ¶
func NewCustomGeoController(g *gin.RouterGroup, customGeo *service.CustomGeoService) *CustomGeoController
type GroupController ¶
type GroupController struct {
// contains filtered or unexported fields
}
func NewGroupController ¶
func NewGroupController(g *gin.RouterGroup) *GroupController
type InboundController ¶
type InboundController struct {
// contains filtered or unexported fields
}
InboundController handles HTTP requests related to Xray inbounds management.
func NewInboundController ¶
func NewInboundController(g *gin.RouterGroup) *InboundController
NewInboundController creates a new InboundController and sets up its routes.
type IndexController ¶
type IndexController struct {
BaseController
// contains filtered or unexported fields
}
IndexController handles the main index and login-related routes.
func NewIndexController ¶
func NewIndexController(g *gin.RouterGroup) *IndexController
NewIndexController creates a new IndexController and initializes its routes.
type LUIController ¶
type LUIController struct {
BaseController
// contains filtered or unexported fields
}
LUIController is the main controller for the X-UI panel, managing sub-controllers.
func NewLUIController ¶
func NewLUIController(g *gin.RouterGroup) *LUIController
NewLUIController creates a new LUIController and initializes its routes.
type LoginForm ¶
type LoginForm struct {
Username string `json:"username" form:"username"`
Password string `json:"password" form:"password"`
TwoFactorCode string `json:"twoFactorCode" form:"twoFactorCode"`
}
LoginForm represents the login request structure.
type NodeController ¶
type NodeController struct {
// contains filtered or unexported fields
}
func NewNodeController ¶
func NewNodeController(g *gin.RouterGroup) *NodeController
type ServerContext ¶
type ServerController ¶
type ServerController struct {
BaseController
// contains filtered or unexported fields
}
ServerController handles server management and status-related operations.
func NewServerController ¶
func NewServerController(g *gin.RouterGroup) *ServerController
NewServerController creates a new ServerController, initializes routes, and starts background tasks.
type SettingController ¶
type SettingController struct {
// contains filtered or unexported fields
}
SettingController handles settings and user management operations.
func NewSettingController ¶
func NewSettingController(g *gin.RouterGroup) *SettingController
NewSettingController creates a new SettingController and initializes its routes.
type WebSocketController ¶
type WebSocketController struct {
BaseController
// contains filtered or unexported fields
}
WebSocketController handles the HTTP→WebSocket upgrade for real-time updates. All per-connection lifecycle (pumps, hub registration) lives in service.WebSocketService — this controller is HTTP-layer only.
func NewWebSocketController ¶
func NewWebSocketController(svc *service.WebSocketService) *WebSocketController
NewWebSocketController creates a controller wired to the given service.
func (*WebSocketController) HandleWebSocket ¶
func (w *WebSocketController) HandleWebSocket(c *gin.Context)
HandleWebSocket authenticates the request, upgrades the HTTP connection, and hands ownership of the connection off to the service.
type XraySettingController ¶
type XraySettingController struct {
XraySettingService service.XraySettingService
SettingService service.SettingService
InboundService service.InboundService
OutboundService service.OutboundService
XrayService service.XrayService
WarpService service.WarpService
NordService service.NordService
}
XraySettingController handles Xray configuration and settings operations.
func NewXraySettingController ¶
func NewXraySettingController(g *gin.RouterGroup) *XraySettingController
NewXraySettingController creates a new XraySettingController and initializes its routes.