From 733289cd0edce63e207a69e579c3ae3f5cea699e Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 19 Mar 2023 19:21:46 +0800 Subject: [PATCH] Bump version to v1.6.8.0 --- .github/workflows/release.yml | 2 +- V2RayGCon/Properties/AssemblyInfo.cs | 3 +- ...24\250\350\257\264\346\230\216-v1.0.5.txt" | 3 + ...0\345\234\250\345\233\275\345\256\266.lua" | 69 +++++++++---------- V2RayGCon/V2RayGCon.csproj | 6 +- 5 files changed, 43 insertions(+), 40 deletions(-) rename "V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.4.txt" => "V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.5.txt" (89%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7e36160..966a4e31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: verStr: '1.6.x' boxAppend: box v2rayCorePkgName: 'v2ray-windows-64.zip' - scriptPkgName: 'scripts-v1.0.4' + scriptPkgName: 'scripts-v1.0.5' v2rayCoreVer: 'v4.45.2' # https://github.com/v2ray/v2ray-core/releases/download/v4.20.0/v2ray-windows-32.zip # https://github.com/XTLS/Xray-core/releases/download/v1.4.0/Xray-windows-64.zip diff --git a/V2RayGCon/Properties/AssemblyInfo.cs b/V2RayGCon/Properties/AssemblyInfo.cs index b068fc7b..9180d3cf 100644 --- a/V2RayGCon/Properties/AssemblyInfo.cs +++ b/V2RayGCon/Properties/AssemblyInfo.cs @@ -33,10 +33,11 @@ // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.7.10")] +[assembly: AssemblyVersion("1.6.8.0")] [assembly: AssemblyFileVersion("1.0.0.0")] /* + * ------------------------------------------------------------- * v1.6.7.10 Show custom tags in ServerUI. * v1.6.7.9 Add Server:Delete() in Luna plug-in. * v1.6.7.8 Try to fix index not update bug. diff --git "a/V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.4.txt" "b/V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.5.txt" similarity index 89% rename from "V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.4.txt" rename to "V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.5.txt" index d6a02be1..b0c8d118 100644 --- "a/V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.4.txt" +++ "b/V2RayGCon/Resources/Files/Scripts/\344\275\277\347\224\250\350\257\264\346\230\216-v1.0.5.txt" @@ -18,6 +18,9 @@ script.zip里面有四个长驻脚本分别是: 更新记录 +v1.0.5 +修改`查询服务器所在国家.lua` + v1.0.4 添加`故障转移.lua` 修改`托管(简单版).lua`的默认参数 diff --git "a/V2RayGCon/Resources/Files/Scripts/\346\237\245\350\257\242\346\234\215\345\212\241\345\231\250\346\211\200\345\234\250\345\233\275\345\256\266.lua" "b/V2RayGCon/Resources/Files/Scripts/\346\237\245\350\257\242\346\234\215\345\212\241\345\231\250\346\211\200\345\234\250\345\233\275\345\256\266.lua" index 5f6e172b..a63197c9 100644 --- "a/V2RayGCon/Resources/Files/Scripts/\346\237\245\350\257\242\346\234\215\345\212\241\345\231\250\346\211\200\345\234\250\345\233\275\345\256\266.lua" +++ "b/V2RayGCon/Resources/Files/Scripts/\346\237\245\350\257\242\346\234\215\345\212\241\345\231\250\346\211\200\345\234\250\345\233\275\345\256\266.lua" @@ -1,26 +1,15 @@ --[[ 查询服务器所在国家然后保存到tag1中 -2021-09-22 +2023-03-19 --]] local geoAPI = "http://ip-api.com/json/" +local utils = require('lua.libs.utils') local json = require('lua.libs.json') local proxyPort = Web:GetProxyPort() -local servs = Server:GetAllServers() - -function IsDupSummary(summary, index) - for i = 0, index - 1 do - local coreServ = servs[i] - local coreState = coreServ:GetCoreStates() - local s = coreState:GetSummary() - if s == summary then - return true - end - end - return false -end +local cache = {} function GetHost(summary) local t = {} @@ -38,48 +27,54 @@ function GetGeoInfo(host) local resp = Web:Fetch(url, proxyPort, 5000) Misc:Sleep(300) local o = json.decode(resp) - return o["country"] + return o["countryCode"] end function TryGetGeoInfo(host) - for i = 0, 10 do + local c = cache[host] + if c ~= nil then + print("using cache for ", host) + return c + end + for i = 0, 5 do + if Signal:Stop() then + return nil + end local ok, country = pcall(GetGeoInfo, host) if ok then + cache[host] = country return country end Misc:Sleep(5000) - print("Error: ", country) + print("error: ", country) end return nil end -function Proc(coreServ, index) +function Proc(coreServ) local coreState = coreServ:GetCoreStates() + local tag1 = coreState:GetTag1() + if not string.isempty(tag1) then + return + end local summary = coreState:GetSummary() - if not IsDupSummary(summary, index) then - local host = GetHost(summary) - if host ~= nil then - local title = coreState:GetTitle() - local country = TryGetGeoInfo(host) - if country ~= nil then - coreState:SetTag1(country) - print(title, " -> ", country) - else - print("Get GEO info failed: ", title) - end + local host = GetHost(summary) + if host ~= nil then + local title = coreState:GetTitle() + local country = TryGetGeoInfo(host) + if country ~= nil then + coreState:SetTag1(country) + print(title, " -> ", country) + else + print("fail to get GEO info: ", title) end end end function Main() - local max = servs.Count - for i = 0, max - 1 do - local coreServ = servs[i] - local coreState = coreServ:GetCoreStates() - local tag1 = coreState:GetTag1() - if string.isempty(tag1) then - Proc(coreServ, i) - end + local servs = Server:GetAllServers() + for coreServ in Each(servs) do + Proc(coreServ, i) if Signal:Stop() then return end diff --git a/V2RayGCon/V2RayGCon.csproj b/V2RayGCon/V2RayGCon.csproj index ed7d7b8b..0f1199d0 100644 --- a/V2RayGCon/V2RayGCon.csproj +++ b/V2RayGCon/V2RayGCon.csproj @@ -537,8 +537,12 @@ + + + + @@ -550,7 +554,7 @@ - +