Skip to content

Commit

Permalink
添加xray-ui geoip 更新IP库 添加数据库导入导出
Browse files Browse the repository at this point in the history
  • Loading branch information
qist committed May 15, 2023
1 parent d302c6c commit a7c62bb
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 配置多选!
Expand Down
2 changes: 1 addition & 1 deletion config/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.10
1.8.11
4 changes: 4 additions & 0 deletions database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 生成"
Expand Down
24 changes: 12 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"xray-ui/web"
"xray-ui/web/global"
"xray-ui/web/service"

"github.com/op/go-logging"
)

Expand Down Expand Up @@ -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()
Expand All @@ -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)

}
}


Expand Down
18 changes: 17 additions & 1 deletion xray-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 生成"
Expand Down Expand Up @@ -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 "------------------------------------------"
Expand Down Expand Up @@ -606,8 +616,11 @@ show_menu() {
16)
update_shell
;;
17)
geoip
;;
*)
echo -e "${red}请输入正确的数字 [0-16]${plain}"
echo -e "${red}请输入正确的数字 [0-17]${plain}"
;;
esac
}
Expand Down Expand Up @@ -650,6 +663,9 @@ if [[ $# > 0 ]]; then
"update_shell")
update_shell 0
;;
"geoip")
geoip 0
;;
"uninstall")
check_install 0 && uninstall 0
;;
Expand Down

0 comments on commit a7c62bb

Please sign in to comment.