Compare commits

...

5 Commits

Author SHA1 Message Date
Alireza Ahmadi
2ae72aa8d1 v1.9.1 2025-09-18 23:33:13 +02:00
Alireza Ahmadi
1b0828eb3e Merge pull request #1596 from alireza0/test
go package correction
2025-09-18 22:45:53 +02:00
Alireza Ahmadi
b6252151f4 go package correction 2025-09-18 22:33:02 +02:00
Alireza Ahmadi
832d561d52 fix xray filename in arm docker image #1587 2025-09-18 00:32:49 +02:00
Alireza Ahmadi
d7fd3e2109 [api] add server endpoint #1590 2025-09-17 23:23:16 +02:00
43 changed files with 209 additions and 160 deletions

View File

@@ -14,7 +14,7 @@ case $1 in
;; ;;
armv7 | arm | arm32) armv7 | arm | arm32)
ARCH="arm32-v7a" ARCH="arm32-v7a"
FNAME="arm32" FNAME="arm"
;; ;;
*) *)
ARCH="64" ARCH="64"

View File

@@ -209,7 +209,6 @@ docker build -t x-ui .
| :----: | --------------------------------- | ----------------------------------------- | | :----: | --------------------------------- | ----------------------------------------- |
| `GET` | `"/"` | Get all inbounds | | `GET` | `"/"` | Get all inbounds |
| `GET` | `"/get/:id"` | Get inbound with inbound.id | | `GET` | `"/get/:id"` | Get inbound with inbound.id |
| `GET` | `"/createbackup"` | Telegram bot sends backup to admins |
| `POST` | `"/add"` | Add inbound | | `POST` | `"/add"` | Add inbound |
| `POST` | `"/del/:id"` | Delete inbound | | `POST` | `"/del/:id"` | Delete inbound |
| `POST` | `"/update/:id"` | Update inbound | | `POST` | `"/update/:id"` | Update inbound |
@@ -224,11 +223,33 @@ docker build -t x-ui .
| `POST` | `"/delDepletedClients/:id"` | Delete inbound depleted clients (-1: all) | | `POST` | `"/delDepletedClients/:id"` | Delete inbound depleted clients (-1: all) |
| `POST` | `"/onlines"` | Get online users ( list of emails ) | | `POST` | `"/onlines"` | Get online users ( list of emails ) |
\*- The field `clientId` should be filled by: \*- The field `clientId` should be filled by:
- `client.id` for VMess and VLESS - `client.id` for VMess and VLESS
- `client.password` for Trojan - `client.password` for Trojan
- `client.email` for Shadowsocks - `client.email` for Shadowsocks
- `/xui/API/server` base for following actions:
| Method | Path | Action |
| :----: | --------------------------------- | ----------------------------------------- |
| `GET` | `"/status"` | Get server status |
| `GET` | `"/getDb"` | Get database backup |
| `GET` | `"/createbackup"` | Telegram bot sends backup to admins |
| `GET` | `"/getConfigJson"` | Get config.json |
| `GET` | `"/getXrayVersion"` | Get last xray versions |
| `GET` | `"/getNewVlessEnc"` | Get new vless enc |
| `GET` | `"/getNewX25519Cert"` | Get new x25519 cert |
| `GET` | `"/getNewmldsa65"` | Get new mldsa65 |
| `POST` | `"/getNewEchCert"` | Get new ech cert |
| `POST` | `"/importDB"` | Import database to x-ui |
| `POST` | `"/stopXrayService"` | Stop xray service |
| `POST` | `"/restartXrayService"` | Restart xray service |
| `POST` | `"/installXray/:version"` | Install specific version of xray |
| `POST` | `"/logs/:count"` | Get panel/xray logs |
</details> </details>

View File

@@ -1 +1 @@
1.9.0 1.9.1

View File

@@ -7,9 +7,9 @@ import (
"os" "os"
"path" "path"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
"gorm.io/driver/sqlite" "gorm.io/driver/sqlite"
"gorm.io/gorm" "gorm.io/gorm"

View File

@@ -3,8 +3,8 @@ package model
import ( import (
"fmt" "fmt"
"x-ui/util/json_util" "github.com/alireza0/x-ui/util/json_util"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
) )
type Protocol string type Protocol string

2
go.mod
View File

@@ -1,4 +1,4 @@
module x-ui module github.com/alireza0/x-ui
go 1.25.1 go 1.25.1

14
main.go
View File

@@ -12,13 +12,13 @@ import (
"syscall" "syscall"
_ "unsafe" _ "unsafe"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/sub" "github.com/alireza0/x-ui/sub"
"x-ui/web" "github.com/alireza0/x-ui/web"
"x-ui/web/global" "github.com/alireza0/x-ui/web/global"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/op/go-logging" "github.com/op/go-logging"
"github.com/shirou/gopsutil/v4/net" "github.com/shirou/gopsutil/v4/net"

View File

@@ -8,12 +8,12 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/web/middleware" "github.com/alireza0/x-ui/web/middleware"
"x-ui/web/network" "github.com/alireza0/x-ui/web/network"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -6,12 +6,12 @@ import (
"fmt" "fmt"
"strings" "strings"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/json_util" "github.com/alireza0/x-ui/util/json_util"
"x-ui/util/random" "github.com/alireza0/x-ui/util/random"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
) )
//go:embed default.json //go:embed default.json

View File

@@ -7,13 +7,13 @@ import (
"strings" "strings"
"time" "time"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/util/random" "github.com/alireza0/x-ui/util/random"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
"github.com/goccy/go-json" "github.com/goccy/go-json"
) )

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
) )
func NewErrorf(format string, a ...interface{}) error { func NewErrorf(format string, a ...interface{}) error {

View File

@@ -1,7 +1,7 @@
package controller package controller
import ( import (
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@@ -9,27 +9,36 @@ import (
type APIController struct { type APIController struct {
BaseController BaseController
inboundController *InboundController inboundController *InboundController
serverController *ServerController
Tgbot service.Tgbot Tgbot service.Tgbot
} }
func NewAPIController(g *gin.RouterGroup) *APIController { func NewAPIController(g *gin.RouterGroup, s *ServerController) *APIController {
a := &APIController{} a := &APIController{
serverController: s,
}
a.initRouter(g) a.initRouter(g)
return a return a
} }
func (a *APIController) initRouter(g *gin.RouterGroup) { func (a *APIController) initRouter(g *gin.RouterGroup) {
g = g.Group("/xui/API/inbounds") api := g.Group("/xui/API")
g.Use(a.checkLogin) api.Use(a.checkLogin)
a.inboundController = NewInboundController(g) a.inboundApi(api)
a.serverApi(api)
}
func (a *APIController) inboundApi(api *gin.RouterGroup) {
inboundsApi := api.Group("/inbounds")
a.inboundController = &InboundController{}
inboundRoutes := []struct { inboundRoutes := []struct {
Method string Method string
Path string Path string
Handler gin.HandlerFunc Handler gin.HandlerFunc
}{ }{
{"GET", "/createbackup", a.createBackup},
{"GET", "/", a.inboundController.getInbounds}, {"GET", "/", a.inboundController.getInbounds},
{"GET", "/get/:id", a.inboundController.getInbound}, {"GET", "/get/:id", a.inboundController.getInbound},
{"GET", "/getClientTraffics/:email", a.inboundController.getClientTraffics}, {"GET", "/getClientTraffics/:email", a.inboundController.getClientTraffics},
@@ -48,7 +57,37 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
} }
for _, route := range inboundRoutes { for _, route := range inboundRoutes {
g.Handle(route.Method, route.Path, route.Handler) inboundsApi.Handle(route.Method, route.Path, route.Handler)
}
}
func (a *APIController) serverApi(api *gin.RouterGroup) {
serverApi := api.Group("/server")
serverRoutes := []struct {
Method string
Path string
Handler gin.HandlerFunc
}{
{"GET", "/status", a.serverController.status},
{"GET", "/getDb", a.serverController.getDb},
{"GET", "/createbackup", a.createBackup},
{"GET", "/getConfigJson", a.serverController.getConfigJson},
{"GET", "/getXrayVersion", a.serverController.getXrayVersion},
{"GET", "/getNewVlessEnc", a.serverController.getNewVlessEnc},
{"GET", "/getNewX25519Cert", a.serverController.getNewX25519Cert},
{"GET", "/getNewmldsa65", a.serverController.getNewmldsa65},
{"POST", "/getNewEchCert", a.serverController.getNewEchCert},
{"POST", "/importDB", a.serverController.importDB},
{"POST", "/stopXrayService", a.serverController.stopXrayService},
{"POST", "/restartXrayService", a.serverController.restartXrayService},
{"POST", "/installXray/:version", a.serverController.installXray},
{"POST", "/logs/:count", a.serverController.getLogs},
}
for _, route := range serverRoutes {
serverApi.Handle(route.Method, route.Path, route.Handler)
} }
} }

View File

@@ -3,9 +3,9 @@ package controller
import ( import (
"net/http" "net/http"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/web/locale" "github.com/alireza0/x-ui/web/locale"
"x-ui/web/session" "github.com/alireza0/x-ui/web/session"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -5,9 +5,9 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"x-ui/web/session" "github.com/alireza0/x-ui/web/session"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@@ -99,8 +99,7 @@ func (a *InboundController) addInbound(c *gin.Context) {
inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port) inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
} }
needRestart := false inbound, needRestart, err := a.inboundService.AddInbound(inbound)
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -113,8 +112,7 @@ func (a *InboundController) delInbound(c *gin.Context) {
jsonMsg(c, I18nWeb(c, "delete"), err) jsonMsg(c, I18nWeb(c, "delete"), err)
return return
} }
needRestart := true needRestart, err := a.inboundService.DelInbound(id)
needRestart, err = a.inboundService.DelInbound(id)
jsonMsgObj(c, I18nWeb(c, "delete"), id, err) jsonMsgObj(c, I18nWeb(c, "delete"), id, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -135,8 +133,7 @@ func (a *InboundController) updateInbound(c *gin.Context) {
jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err) jsonMsg(c, I18nWeb(c, "pages.inbounds.update"), err)
return return
} }
needRestart := true inbound, needRestart, err := a.inboundService.UpdateInbound(inbound)
inbound, needRestart, err = a.inboundService.UpdateInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.update"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.update"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()
@@ -151,9 +148,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
return return
} }
needRestart := true needRestart, err := a.inboundService.AddInboundClient(data)
needRestart, err = a.inboundService.AddInboundClient(data)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -172,9 +167,7 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
} }
clientId := c.Param("clientId") clientId := c.Param("clientId")
needRestart := true needRestart, err := a.inboundService.DelInboundClient(id, clientId)
needRestart, err = a.inboundService.DelInboundClient(id, clientId)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -195,9 +188,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
return return
} }
needRestart := true needRestart, err := a.inboundService.UpdateInboundClient(inbound, clientId)
needRestart, err = a.inboundService.UpdateInboundClient(inbound, clientId)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -216,9 +207,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
} }
email := c.Param("email") email := c.Param("email")
needRestart := true needRestart, err := a.inboundService.ResetClientTraffic(id, email)
needRestart, err = a.inboundService.ResetClientTraffic(id, email)
if err != nil { if err != nil {
jsonMsg(c, "Something went wrong!", err) jsonMsg(c, "Something went wrong!", err)
return return
@@ -292,8 +281,7 @@ func (a *InboundController) importInbound(c *gin.Context) {
inbound.ClientStats[index].Enable = true inbound.ClientStats[index].Enable = true
} }
needRestart := false inbound, needRestart, err := a.inboundService.AddInbound(inbound)
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err) jsonMsgObj(c, I18nWeb(c, "pages.inbounds.create"), inbound, err)
if err == nil && needRestart { if err == nil && needRestart {
a.xrayService.SetToNeedRestart() a.xrayService.SetToNeedRestart()

View File

@@ -5,9 +5,9 @@ import (
"text/template" "text/template"
"time" "time"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"x-ui/web/session" "github.com/alireza0/x-ui/web/session"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -6,8 +6,8 @@ import (
"regexp" "regexp"
"time" "time"
"x-ui/web/global" "github.com/alireza0/x-ui/web/global"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@@ -39,20 +39,20 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
g = g.Group("/server") g = g.Group("/server")
g.Use(a.checkLogin) g.Use(a.checkLogin)
g.GET("/status", a.status)
g.GET("/getDb", a.getDb) g.GET("/getDb", a.getDb)
g.GET("/getConfigJson", a.getConfigJson)
g.GET("/getNewmldsa65", a.getNewmldsa65)
g.GET("/getNewVlessEnc", a.getNewVlessEnc) g.GET("/getNewVlessEnc", a.getNewVlessEnc)
g.GET("/getXrayVersion", a.getXrayVersion)
g.GET("/getNewX25519Cert", a.getNewX25519Cert)
g.POST("/status", a.status) g.POST("/getNewEchCert", a.getNewEchCert)
g.POST("/getXrayVersion", a.getXrayVersion)
g.POST("/stopXrayService", a.stopXrayService) g.POST("/stopXrayService", a.stopXrayService)
g.POST("/restartXrayService", a.restartXrayService) g.POST("/restartXrayService", a.restartXrayService)
g.POST("/installXray/:version", a.installXray) g.POST("/installXray/:version", a.installXray)
g.POST("/logs/:count", a.getLogs) g.POST("/logs/:count", a.getLogs)
g.POST("/getConfigJson", a.getConfigJson)
g.POST("/importDB", a.importDB) g.POST("/importDB", a.importDB)
g.POST("/getNewX25519Cert", a.getNewX25519Cert)
g.POST("/getNewmldsa65", a.getNewmldsa65)
g.POST("/getNewEchCert", a.getNewEchCert)
} }
func (a *ServerController) refreshStatus() { func (a *ServerController) refreshStatus() {

View File

@@ -4,9 +4,9 @@ import (
"errors" "errors"
"time" "time"
"x-ui/web/entity" "github.com/alireza0/x-ui/web/entity"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"x-ui/web/session" "github.com/alireza0/x-ui/web/session"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -5,9 +5,9 @@ import (
"net/http" "net/http"
"strings" "strings"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/web/entity" "github.com/alireza0/x-ui/web/entity"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -1,7 +1,7 @@
package controller package controller
import ( import (
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )

View File

@@ -6,7 +6,7 @@ import (
"strings" "strings"
"time" "time"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
) )
type Msg struct { type Msg struct {

View File

@@ -124,7 +124,7 @@
}, },
async getNewX25519Cert(){ async getNewX25519Cert(){
inModal.loading(true); inModal.loading(true);
const msg = await HttpUtil.post('/server/getNewX25519Cert'); const msg = await HttpUtil.get('/server/getNewX25519Cert');
inModal.loading(false); inModal.loading(false);
if (!msg.success) { if (!msg.success) {
return; return;
@@ -138,7 +138,7 @@
}, },
async getNewmldsa65() { async getNewmldsa65() {
inModal.loading(true); inModal.loading(true);
const msg = await HttpUtil.post('/server/getNewmldsa65'); const msg = await HttpUtil.get('/server/getNewmldsa65');
inModal.loading(false); inModal.loading(false);
if (!msg.success) { if (!msg.success) {
return; return;

View File

@@ -535,7 +535,7 @@
this.loadingTip = tip; this.loadingTip = tip;
}, },
async getStatus() { async getStatus() {
const msg = await HttpUtil.post('/server/status'); const msg = await HttpUtil.get('/server/status');
if (msg.success) { if (msg.success) {
this.setStatus(msg.obj); this.setStatus(msg.obj);
} }
@@ -545,7 +545,7 @@
}, },
async openSelectV2rayVersion() { async openSelectV2rayVersion() {
this.loading(true); this.loading(true);
const msg = await HttpUtil.post('server/getXrayVersion'); const msg = await HttpUtil.get('server/getXrayVersion');
this.loading(false); this.loading(false);
if (!msg.success) { if (!msg.success) {
return; return;
@@ -595,7 +595,7 @@
}, },
async openConfig() { async openConfig() {
this.loading(true); this.loading(true);
const msg = await HttpUtil.post('server/getConfigJson'); const msg = await HttpUtil.get('server/getConfigJson');
this.loading(false); this.loading(false);
if (!msg.success) { if (!msg.success) {
return; return;

View File

@@ -4,7 +4,7 @@ import (
"strconv" "strconv"
"time" "time"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/shirou/gopsutil/v4/cpu" "github.com/shirou/gopsutil/v4/cpu"
) )

View File

@@ -1,6 +1,6 @@
package job package job
import "x-ui/web/service" import "github.com/alireza0/x-ui/web/service"
type CheckXrayRunningJob struct { type CheckXrayRunningJob struct {
xrayService service.XrayService xrayService service.XrayService

View File

@@ -1,7 +1,7 @@
package job package job
import ( import (
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
) )
type LoginStatus byte type LoginStatus byte

View File

@@ -1,8 +1,8 @@
package job package job
import ( import (
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
) )
type XrayTrafficJob struct { type XrayTrafficJob struct {

View File

@@ -5,7 +5,7 @@ import (
"io/fs" "io/fs"
"strings" "strings"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/nicksnyder/go-i18n/v2/i18n" "github.com/nicksnyder/go-i18n/v2/i18n"
@@ -48,10 +48,10 @@ func InitLocalizer(i18nFS embed.FS, settingService SettingService) error {
return nil return nil
} }
func createTemplateData(params []string, seperator ...string) map[string]interface{} { func createTemplateData(params []string, separator ...string) map[string]interface{} {
var sep string = "==" var sep string = "=="
if len(seperator) > 0 { if len(separator) > 0 {
sep = seperator[0] sep = separator[0]
} }
templateData := make(map[string]interface{}) templateData := make(map[string]interface{})

View File

@@ -6,11 +6,11 @@ import (
"strings" "strings"
"time" "time"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@@ -5,7 +5,7 @@ import (
"syscall" "syscall"
"time" "time"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
) )
type PanelService struct{} type PanelService struct{}

View File

@@ -17,12 +17,12 @@ import (
"strings" "strings"
"time" "time"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/util/sys" "github.com/alireza0/x-ui/util/sys"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
"github.com/shirou/gopsutil/v4/cpu" "github.com/shirou/gopsutil/v4/cpu"
"github.com/shirou/gopsutil/v4/disk" "github.com/shirou/gopsutil/v4/disk"

View File

@@ -10,13 +10,13 @@ import (
"strings" "strings"
"time" "time"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/util/random" "github.com/alireza0/x-ui/util/random"
"x-ui/util/reflect_util" "github.com/alireza0/x-ui/util/reflect_util"
"x-ui/web/entity" "github.com/alireza0/x-ui/web/entity"
) )
//go:embed config.json //go:embed config.json

View File

@@ -9,13 +9,13 @@ import (
"strings" "strings"
"time" "time"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/web/locale" "github.com/alireza0/x-ui/web/locale"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
) )

View File

@@ -3,9 +3,9 @@ package service
import ( import (
"errors" "errors"
"x-ui/database" "github.com/alireza0/x-ui/database"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"gorm.io/gorm" "gorm.io/gorm"
) )

View File

@@ -7,8 +7,9 @@ import (
"net/http" "net/http"
"os" "os"
"time" "time"
"x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/logger"
"github.com/alireza0/x-ui/util/common"
) )
type WarpService struct { type WarpService struct {

View File

@@ -6,8 +6,8 @@ import (
"runtime" "runtime"
"sync" "sync"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
"go.uber.org/atomic" "go.uber.org/atomic"
) )

View File

@@ -4,8 +4,8 @@ import (
_ "embed" _ "embed"
"encoding/json" "encoding/json"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/xray" "github.com/alireza0/x-ui/xray"
) )
type XraySettingService struct { type XraySettingService struct {

View File

@@ -3,7 +3,7 @@ package session
import ( import (
"encoding/gob" "encoding/gob"
"x-ui/database/model" "github.com/alireza0/x-ui/database/model"
"github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"

View File

@@ -14,15 +14,15 @@ import (
"strings" "strings"
"time" "time"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"x-ui/web/controller" "github.com/alireza0/x-ui/web/controller"
"x-ui/web/job" "github.com/alireza0/x-ui/web/job"
"x-ui/web/locale" "github.com/alireza0/x-ui/web/locale"
"x-ui/web/middleware" "github.com/alireza0/x-ui/web/middleware"
"x-ui/web/network" "github.com/alireza0/x-ui/web/network"
"x-ui/web/service" "github.com/alireza0/x-ui/web/service"
"github.com/gin-contrib/gzip" "github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions"
@@ -228,7 +228,7 @@ func (s *Server) initRouter() (*gin.Engine, error) {
s.index = controller.NewIndexController(g) s.index = controller.NewIndexController(g)
s.server = controller.NewServerController(g) s.server = controller.NewServerController(g)
s.xui = controller.NewXUIController(g) s.xui = controller.NewXUIController(g)
s.api = controller.NewAPIController(g) s.api = controller.NewAPIController(g, s.server)
return engine, nil return engine, nil
} }

View File

@@ -7,8 +7,8 @@ import (
"regexp" "regexp"
"time" "time"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
"github.com/xtls/xray-core/app/proxyman/command" "github.com/xtls/xray-core/app/proxyman/command"
statsService "github.com/xtls/xray-core/app/stats/command" statsService "github.com/xtls/xray-core/app/stats/command"

View File

@@ -3,7 +3,7 @@ package xray
import ( import (
"bytes" "bytes"
"x-ui/util/json_util" "github.com/alireza0/x-ui/util/json_util"
) )
type Config struct { type Config struct {

View File

@@ -3,7 +3,7 @@ package xray
import ( import (
"bytes" "bytes"
"x-ui/util/json_util" "github.com/alireza0/x-ui/util/json_util"
) )
type InboundConfig struct { type InboundConfig struct {

View File

@@ -4,7 +4,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
) )
func NewLogWriter() *LogWriter { func NewLogWriter() *LogWriter {

View File

@@ -12,9 +12,9 @@ import (
"syscall" "syscall"
"time" "time"
"x-ui/config" "github.com/alireza0/x-ui/config"
"x-ui/logger" "github.com/alireza0/x-ui/logger"
"x-ui/util/common" "github.com/alireza0/x-ui/util/common"
) )
func GetBinaryName() string { func GetBinaryName() string {