mirror of
https://github.com/kenzok8/small-package
synced 2025-01-07 07:06:58 +08:00
update 2024-08-15 20:34:25
This commit is contained in:
parent
9263744ab9
commit
9f67512b9e
@ -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 <fengying0347@163.com>
|
||||
|
@ -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"
|
||||
|
@ -219,3 +219,9 @@ msgstr "启用HOST"
|
||||
|
||||
msgid "Domain"
|
||||
msgstr "域名"
|
||||
|
||||
msgid "MosDNS Enabled"
|
||||
msgstr "写入 MosDNS"
|
||||
|
||||
msgid "OpenClash Restart"
|
||||
msgstr "重启 OpenClash"
|
||||
|
@ -219,3 +219,9 @@ msgstr "启用HOST"
|
||||
|
||||
msgid "Domain"
|
||||
msgstr "域名"
|
||||
|
||||
msgid "MosDNS Enabled"
|
||||
msgstr "写入 MosDNS"
|
||||
|
||||
msgid "OpenClash Restart"
|
||||
msgstr "重启 OpenClash"
|
||||
|
@ -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(){
|
||||
@ -130,6 +130,19 @@ function speed_test(){
|
||||
/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
|
||||
@ -144,6 +157,7 @@ function ip_replace(){
|
||||
echolog "CloudflareST 测速结果 IP 数量为 0,跳过下面步骤..."
|
||||
else
|
||||
host_ip
|
||||
mosdns_ip
|
||||
alidns_ip
|
||||
ssr_best_ip
|
||||
vssr_best_ip
|
||||
@ -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"
|
||||
|
@ -12,7 +12,7 @@ PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
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)/
|
||||
|
Loading…
Reference in New Issue
Block a user