From a7c62bb3daed00aabba28dec9e7ca8a13167f6f2 Mon Sep 17 00:00:00 2001 From: qist <87984115@qq.com> Date: Mon, 15 May 2023 17:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0xray-ui=20geoip=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0IP=E5=BA=93=20=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ config/version | 2 +- database/db.go | 4 ++++ install.sh | 1 + main.go | 24 ++++++++++++------------ xray-ui.sh | 18 +++++++++++++++++- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e4e1b682..cfad9fff 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ firewall-cmd --list-all ---------------------------------------------------------------------------------------------------------------------------------------------- 更新日志: +2023.5.15 添加xray-ui geoip 更新IP库 添加数据库导入导出 + 2023.5.6 修复cipherSuites 配置多选 把分割符号从,改成: 由于没看文档就按照常规添加的。很抱歉啊,如果一开始配置了cipherSuites 请改成auto 然后在升级并添加网卡接口可见。 2023.5.4 sniffing 多选,tls cipherSuites 配置多选! diff --git a/config/version b/config/version index 70905879..25ce1132 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -1.8.10 \ No newline at end of file +1.8.11 \ No newline at end of file diff --git a/database/db.go b/database/db.go index 92c0dc03..aa625bb6 100644 --- a/database/db.go +++ b/database/db.go @@ -87,7 +87,11 @@ func InitDB(dbPath string) error { if err != nil { return err } + err = initVersion() + if err != nil { + return err + } err = initInbound() if err != nil { return err diff --git a/install.sh b/install.sh index a6d04857..e13b4d2c 100644 --- a/install.sh +++ b/install.sh @@ -263,6 +263,7 @@ EOF echo -e "xray-ui log - 查看 xray-ui 日志" echo -e "xray-ui v2-ui - 迁移本机器的 v2-ui 账号数据至 xray-ui" echo -e "xray-ui update - 更新 xray-ui 面板" + echo -e "xray-ui geoip - 更新 geoip ip库" echo -e "xray-ui update_shell - 更新 xray-ui 脚本" echo -e "xray-ui install - 安装 xray-ui 面板" echo -e "xray-ui x25519 - REALITY key 生成" diff --git a/main.go b/main.go index 65cd1106..88611f89 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,6 @@ import ( "xray-ui/web" "xray-ui/web/global" "xray-ui/web/service" - "github.com/op/go-logging" ) @@ -214,6 +213,12 @@ func updateSetting(port int, username string, password string, listen string) { func UpdateAllip() { + err := database.InitDB(config.GetDBPath()) + if err != nil { + fmt.Println(err) + return + } + serverService := service.ServerService{} // 创建 ServerService 实例 version, err := serverService.GetLatestVersion() @@ -235,18 +240,13 @@ func UpdateAllip() { } fmt.Printf("GeoIP and Geosite files for version %s downloaded and updated successfully!\n", version) - - // Additional operations using the downloaded file names - // context := &gin.Context{ - // Params: gin.Params{ - // gin.Param{Key: "version", Value: version}, - // }, - // } - // // 更新版本并写入数据库 - // controller := controller.ServerController{} - - // controller.UpdateVersion(context) + GeoipVersion := service.GeoipVersion{} + err = GeoipVersion.UpVersion(version) + if err != nil { + fmt.Println("get current UpVersion failed,error info:", err) + + } } diff --git a/xray-ui.sh b/xray-ui.sh index 4af8210f..466aa716 100644 --- a/xray-ui.sh +++ b/xray-ui.sh @@ -382,6 +382,14 @@ x25519() { before_show_menu } +geoip() { + /usr/local/xray-ui/xray-ui geoip + echo "重启重新加载更新文件" + systemctl restart xray-ui + echo "" + before_show_menu +} + update_shell() { wget -O /usr/bin/xray-ui -N --no-check-certificate https://raw.githubusercontent.com/qist/xray-ui/main/xray-ui.sh if [[ $? != 0 ]]; then @@ -502,6 +510,7 @@ show_usage() { echo "xray-ui log - 查看 xray-ui 日志" echo "xray-ui v2-ui - 迁移本机器的 v2-ui 账号数据至 xray-ui" echo "xray-ui update - 更新 xray-ui 面板" + echo "xray-ui geoip - 更新 geoip ip库" echo "xray-ui update_shell - 更新 xray-ui 脚本" echo "xray-ui install - 安装 xray-ui 面板" echo "xray-ui x25519 - REALITY key 生成" @@ -534,6 +543,7 @@ show_menu() { ———————————————— ${green}15.${plain} xray REALITY x25519 生成 ${green}16.${plain} 更新 xray-ui 脚本 + ${green}17.${plain} 更新 geoip ip库 " show_status echo "------------------------------------------" @@ -606,8 +616,11 @@ show_menu() { 16) update_shell ;; + 17) + geoip + ;; *) - echo -e "${red}请输入正确的数字 [0-16]${plain}" + echo -e "${red}请输入正确的数字 [0-17]${plain}" ;; esac } @@ -650,6 +663,9 @@ if [[ $# > 0 ]]; then "update_shell") update_shell 0 ;; + "geoip") + geoip 0 + ;; "uninstall") check_install 0 && uninstall 0 ;;