From 9f67512b9e6b8e23706fa1421a3d7306a3415f9e Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Thu, 15 Aug 2024 20:34:25 +0800 Subject: [PATCH] update 2024-08-15 20:34:25 --- luci-app-cloudflarespeedtest/Makefile | 2 +- .../cloudflarespeedtest.lua | 55 +++++++------- .../po/zh-cn/cloudflarespeedtest.po | 10 ++- .../po/zh_Hans/cloudflarespeedtest.po | 10 ++- .../cloudflarespeedtest.sh | 72 ++++++++++++++----- v2ray-geodata/Makefile | 2 +- 6 files changed, 101 insertions(+), 50 deletions(-) diff --git a/luci-app-cloudflarespeedtest/Makefile b/luci-app-cloudflarespeedtest/Makefile index fea6a7b6b..f63acb6bf 100644 --- a/luci-app-cloudflarespeedtest/Makefile +++ b/luci-app-cloudflarespeedtest/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=luci-app-cloudflarespeedtest LUCI_TITLE:=LuCI support for Cloudflares Speed Test LUCI_DEPENDS:=+cdnspeedtest +openssl-util +curl LUCI_PKGARCH:=all -PKG_VERSION:=1.5.3 +PKG_VERSION:=1.5.4 PKG_RELEASE:=0 PKG_LICENSE:=AGPL-3.0 PKG_MAINTAINER:=mingxiaoyu diff --git a/luci-app-cloudflarespeedtest/luasrc/model/cbi/cloudflarespeedtest/cloudflarespeedtest.lua b/luci-app-cloudflarespeedtest/luasrc/model/cbi/cloudflarespeedtest/cloudflarespeedtest.lua index 552c30ecd..be10300bf 100644 --- a/luci-app-cloudflarespeedtest/luasrc/model/cbi/cloudflarespeedtest/cloudflarespeedtest.lua +++ b/luci-app-cloudflarespeedtest/luasrc/model/cbi/cloudflarespeedtest/cloudflarespeedtest.lua @@ -24,7 +24,7 @@ o.rmempty=false o=s:option(Value,"speed",translate("Broadband speed")) o.description =translate("100M broadband download speed is about 12M/s. It is not recommended to fill in an excessively large value, and it may run all the time."); -o.datatype ="uinteger" +o.datatype ="uinteger" o.rmempty=false o=s:option(Value,"custome_url",translate("Custome Url")) @@ -59,46 +59,46 @@ o.default = 0 o.rmempty=false o = s:option(Value, "threads", translate("Thread")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 200 o.rmempty=true o:depends("advanced", 1) o = s:option(Value, "tl", translate("Average Latency Cap")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 200 o.rmempty=true o:depends("advanced", 1) o = s:option(Value, "tll", translate("Average Latency Lower Bound")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 40 o.rmempty=true o:depends("advanced", 1) o = s:option(Value, "t", translate("Delayed speed measurement time")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 4 o.rmempty=true o:depends("advanced", 1) - + o = s:option(Value, "dt", translate("Download speed test time")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 10 o.rmempty=true o:depends("advanced", 1) - + o = s:option(Value, "dn", translate("Number of download speed tests")) -o.datatype ="uinteger" +o.datatype ="uinteger" o.default = 1 o.rmempty=true -o:depends("advanced", 1) +o:depends("advanced", 1) o = s:option(Flag, "dd", translate("Disable download speed test")) o.default = 0 o.rmempty=true -o:depends("advanced", 1) - +o:depends("advanced", 1) + o = s:option(Value, "tp", translate("Port")) o.rmempty=true o.default = 443 @@ -112,10 +112,10 @@ o.template = "cloudflarespeedtest/actions" s = m:section(NamedSection, "servers", "section", translate("Third party applications settings")) if nixio.fs.access("/etc/config/shadowsocksr") then - s:tab("ssr", translate("Shadowsocksr Plus+")) + s:tab("ssr", translate("Shadowsocksr Plus+")) o=s:taboption("ssr", Flag, "ssr_enabled",translate("Shadowsocksr Plus+ Enabled")) - o.rmempty=true + o.rmempty=true local ssr_server_table = {} uci:foreach("shadowsocksr", "servers", function(s) @@ -136,7 +136,7 @@ if nixio.fs.access("/etc/config/shadowsocksr") then o = s:taboption("ssr", DynamicList, "ssr_services", translate("Shadowsocksr Servers"), translate("Please select a service")) - + for _, key in pairs(ssr_key_table) do o:value(key, ssr_server_table[key]) end @@ -150,7 +150,7 @@ if nixio.fs.access("/etc/config/passwall") then s:tab("passwalltab", translate("passwall")) o=s:taboption("passwalltab", Flag, "passwall_enabled",translate("Passwall Enabled")) - o.rmempty=true + o.rmempty=true local passwall_server_table = {} uci:foreach("passwall", "nodes", function(s) @@ -169,7 +169,7 @@ if nixio.fs.access("/etc/config/passwall") then o = s:taboption("passwalltab", DynamicList, "passwall_services", translate("Passwall Servers"), translate("Please select a service")) - + for _, key in pairs(passwall_key_table) do o:value(key, passwall_server_table[key]) end @@ -182,7 +182,7 @@ if nixio.fs.access("/etc/config/passwall2") then s:tab("passwall2tab", translate("passwall2")) o=s:taboption("passwall2tab", Flag, "passwall2_enabled",translate("PassWall2 Enabled")) - o.rmempty=true + o.rmempty=true local passwall2_server_table = {} uci:foreach("passwall2", "nodes", function(s) @@ -201,7 +201,7 @@ if nixio.fs.access("/etc/config/passwall2") then o = s:taboption("passwall2tab", DynamicList, "passwall2_services", translate("Passwall2 Servers"), translate("Please select a service")) - + for _, key in pairs(passwall2_key_table) do o:value(key, passwall2_server_table[key]) end @@ -212,9 +212,9 @@ end s:tab("bypasstab", translate("Bypass")) if nixio.fs.access("/etc/config/bypass") then - + o=s:taboption("bypasstab", Flag, "bypass_enabled",translate("Bypass Enabled")) - o.rmempty=true + o.rmempty=true local bypass_server_table = {} uci:foreach("bypass", "servers", function(s) @@ -235,7 +235,7 @@ if nixio.fs.access("/etc/config/bypass") then o = s:taboption("bypasstab", DynamicList, "bypass_services", translate("Bypass Servers"), translate("Please select a service")) - + for _, key in pairs(bypass_key_table) do o:value(key, bypass_server_table[key]) end @@ -246,9 +246,9 @@ end s:tab("vssrtab", translate("Vssr")) if nixio.fs.access("/etc/config/vssr") then - + o=s:taboption("vssrtab", Flag, "vssr_enabled",translate("Vssr Enabled")) - o.rmempty=true + o.rmempty=true local vssr_server_table = {} uci:foreach("vssr", "servers", function(s) @@ -269,7 +269,7 @@ if nixio.fs.access("/etc/config/vssr") then o = s:taboption("vssrtab", DynamicList, "vssr_services", translate("Vssr Servers"), translate("Please select a service")) - + for _, key in pairs(vssr_key_table) do o:value(key, vssr_server_table[key]) end @@ -314,6 +314,11 @@ o=s:taboption("dnshost", Value,"host_domain",translate("Domain")) o.rmempty=true o:depends("HOST_enabled", 1) +s:tab("mosdns", translate("MosDNS")) +o=s:taboption("mosdns", Flag, "MosDNS_enabled",translate("MosDNS Enabled")) +o=s:taboption("mosdns", Flag, "openclash_restart",translate("OpenClash Restart")) +o:depends("MosDNS_enabled", 1) + e=m:section(TypedSection,"global",translate("Best IP")) e.anonymous=true local a="/usr/share/cloudflarespeedtestresult.txt" diff --git a/luci-app-cloudflarespeedtest/po/zh-cn/cloudflarespeedtest.po b/luci-app-cloudflarespeedtest/po/zh-cn/cloudflarespeedtest.po index bbc26bfb9..7b78ae5f3 100644 --- a/luci-app-cloudflarespeedtest/po/zh-cn/cloudflarespeedtest.po +++ b/luci-app-cloudflarespeedtest/po/zh-cn/cloudflarespeedtest.po @@ -114,7 +114,7 @@ msgstr "启用IPv6" msgid "Delayed speed measurement time" msgstr "延迟测速次数" - + msgid "Download speed test time" msgstr "下载测速时间" @@ -136,7 +136,7 @@ msgstr "IPv4和IPv6只能选一个!!!!!!" msgid "How to create" msgstr "如何创建" -msgid "RUNNING" +msgid "RUNNING" msgstr "运行中" msgid "NOT RUNNING" @@ -219,3 +219,9 @@ msgstr "启用HOST" msgid "Domain" msgstr "域名" + +msgid "MosDNS Enabled" +msgstr "写入 MosDNS" + +msgid "OpenClash Restart" +msgstr "重启 OpenClash" diff --git a/luci-app-cloudflarespeedtest/po/zh_Hans/cloudflarespeedtest.po b/luci-app-cloudflarespeedtest/po/zh_Hans/cloudflarespeedtest.po index bbc26bfb9..7b78ae5f3 100644 --- a/luci-app-cloudflarespeedtest/po/zh_Hans/cloudflarespeedtest.po +++ b/luci-app-cloudflarespeedtest/po/zh_Hans/cloudflarespeedtest.po @@ -114,7 +114,7 @@ msgstr "启用IPv6" msgid "Delayed speed measurement time" msgstr "延迟测速次数" - + msgid "Download speed test time" msgstr "下载测速时间" @@ -136,7 +136,7 @@ msgstr "IPv4和IPv6只能选一个!!!!!!" msgid "How to create" msgstr "如何创建" -msgid "RUNNING" +msgid "RUNNING" msgstr "运行中" msgid "NOT RUNNING" @@ -219,3 +219,9 @@ msgstr "启用HOST" msgid "Domain" msgstr "域名" + +msgid "MosDNS Enabled" +msgstr "写入 MosDNS" + +msgid "OpenClash Restart" +msgstr "重启 OpenClash" diff --git a/luci-app-cloudflarespeedtest/root/usr/bin/cloudflarespeedtest/cloudflarespeedtest.sh b/luci-app-cloudflarespeedtest/root/usr/bin/cloudflarespeedtest/cloudflarespeedtest.sh index 1147a2a2a..4c4777e03 100755 --- a/luci-app-cloudflarespeedtest/root/usr/bin/cloudflarespeedtest/cloudflarespeedtest.sh +++ b/luci-app-cloudflarespeedtest/root/usr/bin/cloudflarespeedtest/cloudflarespeedtest.sh @@ -27,7 +27,7 @@ echolog() { function read_config(){ get_global_config "enabled" "speed" "custome_url" "threads" "custome_cors_enabled" "custome_cron" "t" "tp" "dt" "dn" "dd" "tl" "tll" "ipv6_enabled" "advanced" "proxy_mode" - get_servers_config "ssr_services" "ssr_enabled" "passwall_enabled" "passwall_services" "passwall2_enabled" "passwall2_services" "bypass_enabled" "bypass_services" "vssr_enabled" "vssr_services" "DNS_enabled" "HOST_enabled" + get_servers_config "ssr_services" "ssr_enabled" "passwall_enabled" "passwall_services" "passwall2_enabled" "passwall2_services" "bypass_enabled" "bypass_services" "vssr_enabled" "vssr_services" "DNS_enabled" "HOST_enabled" "MosDNS_enabled" "openclash_restart" } function appinit(){ @@ -39,17 +39,17 @@ function appinit(){ } function speed_test(){ - + rm -rf $LOG_FILE - + command="/usr/bin/cdnspeedtest -sl $((speed*125/1000)) -url ${custome_url} -o ${IP_FILE}" - + if [ $ipv6_enabled -eq "1" ] ;then command="${command} -f ${IPV6_TXT}" else command="${command} -f ${IPV4_TXT}" fi - + if [ $advanced -eq "1" ] ; then command="${command} -tl ${tl} -tll ${tll} -n ${threads} -t ${t} -dt ${dt} -dn ${dn}" if [ $dd -eq "1" ] ; then @@ -61,9 +61,9 @@ function speed_test(){ else command="${command} -tl 200 -tll 40 -n 200 -t 4 -dt 10 -dn 1" fi - + appinit - + ssr_original_server=$(uci get shadowsocksr.@global[0].global_server 2>/dev/null) ssr_original_run_mode=$(uci get shadowsocksr.@global[0].run_mode 2>/dev/null) if [ "x${ssr_original_server}" != "xnil" ] && [ "x${ssr_original_server}" != "x" ] ;then @@ -76,7 +76,7 @@ function speed_test(){ uci commit shadowsocksr /etc/init.d/shadowsocksr restart fi - + passwall_server_enabled=$(uci get passwall.@global[0].enabled 2>/dev/null) passwall_original_run_mode=$(uci get passwall.@global[0].tcp_proxy_mode 2>/dev/null) if [ "x${passwall_server_enabled}" == "x1" ] ;then @@ -89,7 +89,7 @@ function speed_test(){ uci commit passwall /etc/init.d/passwall restart 2>/dev/null fi - + passwall2_server_enabled=$(uci get passwall2.@global[0].enabled 2>/dev/null) passwall2_original_run_mode=$(uci get passwall2.@global[0].tcp_proxy_mode 2>/dev/null) if [ "x${passwall2_server_enabled}" == "x1" ] ;then @@ -102,11 +102,11 @@ function speed_test(){ uci commit passwall2 /etc/init.d/passwall2 restart 2>/dev/null fi - + vssr_original_server=$(uci get vssr.@global[0].global_server 2>/dev/null) vssr_original_run_mode=$(uci get vssr.@global[0].run_mode 2>/dev/null) if [ "x${vssr_original_server}" != "xnil" ] && [ "x${vssr_original_server}" != "x" ] ;then - + if [ $proxy_mode == "close" ] ;then uci set vssr.@global[0].global_server="nil" elif [ $proxy_mode == "gfw" ] ;then @@ -116,7 +116,7 @@ function speed_test(){ uci commit vssr /etc/init.d/vssr restart fi - + bypass_original_server=$(uci get bypass.@global[0].global_server 2>/dev/null) bypass_original_run_mode=$(uci get bypass.@global[0].run_mode 2>/dev/null) if [ "x${bypass_original_server}" != "x" ] ;then @@ -129,7 +129,20 @@ function speed_test(){ uci commit bypass /etc/init.d/bypass restart fi - + + if [ "x${MosDNS_enabled}" == "x1" ] ;then + if [ -n "$(grep 'option cloudflare' /etc/config/mosdns)" ] + then + sed -i".bak" "/option cloudflare/d" /etc/config/mosdns + fi + sed -i '/^$/d' /etc/config/mosdns && echo -e "\toption cloudflare '0'" >> /etc/config/mosdns + + /etc/init.d/mosdns restart &>/dev/null + if [ "x${openclash_restart}" == "x1" ] ;then + /etc/init.d/openclash restart &>/dev/null + fi + fi + echo $command >> $LOG_FILE 2>&1 echolog "-----------start----------" $command >> $LOG_FILE 2>&1 @@ -137,13 +150,14 @@ function speed_test(){ } function ip_replace(){ - + # 获取最快 IP(从 result.csv 结果文件中获取第一个 IP) bestip=$(sed -n "2,1p" $IP_FILE | awk -F, '{print $1}') if [[ -z "${bestip}" ]]; then echolog "CloudflareST 测速结果 IP 数量为 0,跳过下面步骤..." else host_ip + mosdns_ip alidns_ip ssr_best_ip vssr_best_ip @@ -151,7 +165,7 @@ function ip_replace(){ passwall_best_ip passwall2_best_ip restart_app - + fi } @@ -174,6 +188,26 @@ function host_ip() { fi } +function mosdns_ip() { + if [ "x${MosDNS_enabled}" == "x1" ] ;then + if [ -n "$(grep 'option cloudflare' /etc/config/mosdns)" ] + then + sed -i".bak" "/option cloudflare/d" /etc/config/mosdns + fi + if [ -n "$(grep 'list cloudflare_ip' /etc/config/mosdns)" ] + then + sed -i".bak" "/list cloudflare_ip/d" /etc/config/mosdns + fi + sed -i '/^$/d' /etc/config/mosdns && echo -e "\toption cloudflare '1'\n\tlist cloudflare_ip '$bestip'" >> /etc/config/mosdns + + /etc/init.d/mosdns restart &>/dev/null + if [ "x${openclash_restart}" == "x1" ] ;then + /etc/init.d/openclash restart &>/dev/null + fi + echolog "MosDNS 写入完成" + fi +} + function passwall_best_ip(){ if [ "x${passwall_enabled}" == "x1" ] ;then echolog "设置passwall IP" @@ -246,7 +280,7 @@ function restart_app(){ /etc/init.d/shadowsocksr restart &>/dev/null echolog "ssr重启完成" fi - + if [ "x${passwall_started}" == "x1" ] ;then if [ $proxy_mode == "close" ] ;then uci set passwall.@global[0].enabled="${passwall_server_enabled}" @@ -257,7 +291,7 @@ function restart_app(){ /etc/init.d/passwall restart 2>/dev/null echolog "passwall重启完成" fi - + if [ "x${passwall2_started}" == "x1" ] ;then if [ $proxy_mode == "close" ] ;then uci set passwall2.@global[0].enabled="${passwall2_server_enabled}" @@ -268,7 +302,7 @@ function restart_app(){ /etc/init.d/passwall2 restart 2>/dev/null echolog "passwall2重启完成" fi - + if [ "x${vssr_started}" == "x1" ] ;then if [ $proxy_mode == "close" ] ;then uci set vssr.@global[0].global_server="${vssr_original_server}" @@ -279,7 +313,7 @@ function restart_app(){ /etc/init.d/vssr restart &>/dev/null echolog "Vssr重启完成" fi - + if [ "x${bypass_started}" == "x1" ] ;then if [ $proxy_mode == "close" ] ;then uci set bypass.@global[0].global_server="${bypass_original_server}" diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile index 9de3f3263..2ea3cdcbc 100644 --- a/v2ray-geodata/Makefile +++ b/v2ray-geodata/Makefile @@ -12,7 +12,7 @@ PKG_MAINTAINER:=Tianling Shen include $(INCLUDE_DIR)/package.mk -GEOIP_VER:=202408150211 +GEOIP_VER:=202408150441 GEOIP_FILE:=geoip.dat.$(GEOIP_VER) define Download/geoip URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/