update 2023-03-15 22:53:53
This commit is contained in:
parent
73735f1df5
commit
b52240df93
|
@ -7,7 +7,7 @@ config AdGuardHome 'AdGuardHome'
|
|||
option workdir '/tmp/AdGuardHome'
|
||||
option logfile '/tmp/AdGuardHome.log'
|
||||
option verbose '0'
|
||||
option binpath '/usr/bin/AdGuardHome/AdGuardHome'
|
||||
option binpath '/usr/bin/AdGuardHome'
|
||||
option upxflag '-1'
|
||||
|
||||
option waitonboot '0'
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-amlogic
|
||||
PKG_VERSION:=3.1.160
|
||||
PKG_VERSION:=3.1.161
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 License
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
AUTO_MAINLINE_UBOOT="no"
|
||||
# Set the release check file
|
||||
release_file="/etc/flippy-openwrt-release"
|
||||
# Current device model
|
||||
MYDEVICE_NAME="$(cat /proc/device-tree/model | tr -d '\000')"
|
||||
#
|
||||
#====================================================================================
|
||||
|
||||
|
@ -74,17 +72,14 @@ init_var() {
|
|||
fi
|
||||
[[ -n "${PLATFORM}" ]] || error_msg "Missing ${PLATFORM} value in ${release_file} file."
|
||||
|
||||
# Define supported platforms
|
||||
support_platform=("allwinner" "rockchip" "amlogic" "qemu-aarch64")
|
||||
[[ -n "$(echo "${support_platform[@]}" | grep -w "${PLATFORM}")" ]] || error_msg "[ ${PLATFORM} ] is not supported."
|
||||
|
||||
# Set /boot/vmlinuz-* replication names for different SoCs
|
||||
case "${PLATFORM}" in
|
||||
allwinner) MYBOOT_VMLINUZ="zImage" ;;
|
||||
rockchip) MYBOOT_VMLINUZ="Image" ;;
|
||||
amlogic) MYBOOT_VMLINUZ="zImage" ;;
|
||||
qemu-aarch64)
|
||||
MYBOOT_VMLINUZ="vmlinuz"
|
||||
MYDEVICE_NAME="KVM Virtual Machine"
|
||||
;;
|
||||
*) error_msg "Unknown device: [ ${MYDEVICE_NAME} ], Not supported." ;;
|
||||
esac
|
||||
MYBOOT_VMLINUZ="$(ls -l /boot/*Image 2>/dev/null | awk '{print $9}' | head -n 1)"
|
||||
MYBOOT_VMLINUZ="${MYBOOT_VMLINUZ##*/}"
|
||||
[[ -n "${MYBOOT_VMLINUZ}" ]] || error_msg "Failed to get Image name: [ ${MYBOOT_VMLINUZ} ]"
|
||||
|
||||
# Find the partition where root is located
|
||||
ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')"
|
||||
|
@ -112,6 +107,9 @@ init_var() {
|
|||
# Move kernel related files to the ${P4_PATH} directory
|
||||
mv -f /tmp/upload/* ${P4_PATH} 2>/dev/null
|
||||
|
||||
# Current device model
|
||||
MYDEVICE_NAME="$(cat /proc/device-tree/model | tr -d '\000')"
|
||||
[[ "${PLATFORM}" == "qemu-aarch64" ]] && MYDEVICE_NAME="KVM Virtual Machine"
|
||||
echo -e "Current device: ${MYDEVICE_NAME} [ ${PLATFORM} ], Use in [ ${EMMC_NAME} ]"
|
||||
sync && echo ""
|
||||
}
|
||||
|
@ -121,8 +119,8 @@ check_kernel() {
|
|||
cd ${P4_PATH}
|
||||
|
||||
# Determine custom kernel filename
|
||||
kernel_boot="$(ls boot-*.tar.gz | head -n 1)"
|
||||
kernel_name="${kernel_boot/boot-/}" && kernel_name="${kernel_name/.tar.gz/}"
|
||||
kernel_boot="$(ls boot-*.tar.gz 2>/dev/null | head -n 1)"
|
||||
kernel_name="${kernel_boot:5:-7}"
|
||||
|
||||
KERNEL_VERSION="$(echo ${kernel_name} | grep -oE '^[1-9].[0-9]{1,3}.[0-9]+')"
|
||||
echo -e "Kernel name: ${kernel_name}"
|
||||
|
|
|
@ -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.0
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=0
|
||||
PKG_LICENSE:=AGPL-3.0
|
||||
PKG_MAINTAINER:=mingxiaoyu <fengying0347@163.com>
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
#!/bin/sh
|
||||
|
||||
LOG_FILE='/var/log/cloudflarespeedtest.log'
|
||||
IP_FILE='/usr/share/cloudflarespeedtestresult.txt'
|
||||
IPV4_TXT='/usr/share/CloudflareSpeedTest/ip.txt'
|
||||
IPV6_TXT='/usr/share/CloudflareSpeedTest/ipv6.txt'
|
||||
|
||||
function get_global_config(){
|
||||
while [[ "$*" != "" ]]; do
|
||||
eval ${1}='`uci get cloudflarespeedtest.global.$1`' 2>/dev/null
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
function get_servers_config(){
|
||||
while [[ "$*" != "" ]]; do
|
||||
eval ${1}='`uci get cloudflarespeedtest.servers.$1`' 2>/dev/null
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
echolog() {
|
||||
local d="$(date "+%Y-%m-%d %H:%M:%S")"
|
||||
echo -e "$d: $*"
|
||||
echo -e "$d: $*" >>$LOG_FILE
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
function appinit(){
|
||||
ssr_started='';
|
||||
passwall_started='';
|
||||
passwall2_started='';
|
||||
bypass_started='';
|
||||
vssr_started='';
|
||||
}
|
||||
|
||||
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
|
||||
command="${command} -dd"
|
||||
fi
|
||||
if [ $tp -ne "443" ] ; then
|
||||
command="${command} -tp ${tp}"
|
||||
fi
|
||||
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
|
||||
if [ $proxy_mode == "close" ] ;then
|
||||
uci set shadowsocksr.@global[0].global_server="nil"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set shadowsocksr.@global[0].run_mode="gfw"
|
||||
fi
|
||||
ssr_started='1';
|
||||
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
|
||||
if [ $proxy_mode == "close" ] ;then
|
||||
uci set passwall.@global[0].enabled="0"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set passwall.@global[0].tcp_proxy_mode="gfwlist"
|
||||
fi
|
||||
passwall_started='1';
|
||||
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
|
||||
if [ $proxy_mode == "close" ] ;then
|
||||
uci set passwall2.@global[0].enabled="0"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set passwall2.@global[0].tcp_proxy_mode="gfwlist"
|
||||
fi
|
||||
passwall2_started='1';
|
||||
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
|
||||
uci set vssr.@global[0].run_mode="gfw"
|
||||
fi
|
||||
vssr_started='1';
|
||||
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
|
||||
if [ $proxy_mode == "close" ] ;then
|
||||
uci set bypass.@global[0].global_server=""
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set bypass.@global[0].run_mode="gfw"
|
||||
fi
|
||||
bypass_started='1';
|
||||
uci commit bypass
|
||||
/etc/init.d/bypass restart
|
||||
fi
|
||||
|
||||
echo $command >> $LOG_FILE 2>&1
|
||||
echolog "-----------start----------"
|
||||
$command >> $LOG_FILE 2>&1
|
||||
echolog "-----------end------------"
|
||||
}
|
||||
|
||||
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
|
||||
alidns_ip
|
||||
ssr_best_ip
|
||||
vssr_best_ip
|
||||
bypass_best_ip
|
||||
passwall_best_ip
|
||||
passwall2_best_ip
|
||||
restart_app
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
function host_ip() {
|
||||
if [ "x${HOST_enabled}" == "x1" ] ;then
|
||||
get_servers_config "host_domain"
|
||||
HOSTS_LINE="$bestip $host_domain"
|
||||
if [ -n "$(grep $host_domain /etc/hosts)" ]
|
||||
then
|
||||
sed -i".bak" "/$host_domain/d" /etc/hosts
|
||||
echo $HOSTS_LINE >> /etc/hosts;
|
||||
else
|
||||
echo $HOSTS_LINE >> /etc/hosts;
|
||||
fi
|
||||
/etc/init.d/dnsmasq reload &>/dev/null
|
||||
echolog "HOST 完成"
|
||||
fi
|
||||
}
|
||||
|
||||
function passwall_best_ip(){
|
||||
if [ "x${passwall_enabled}" == "x1" ] ;then
|
||||
echolog "设置passwall IP"
|
||||
for ssrname in $passwall_services
|
||||
do
|
||||
echo $ssrname
|
||||
uci set passwall.$ssrname.address="${bestip}"
|
||||
done
|
||||
uci commit passwall
|
||||
fi
|
||||
}
|
||||
|
||||
function passwall2_best_ip(){
|
||||
if [ "x${passwall2_enabled}" == "x1" ] ;then
|
||||
echolog "设置passwall2 IP"
|
||||
for ssrname in $passwall2_services
|
||||
do
|
||||
echo $ssrname
|
||||
uci set passwall2.$ssrname.address="${bestip}"
|
||||
done
|
||||
uci commit passwall2
|
||||
fi
|
||||
}
|
||||
|
||||
function ssr_best_ip(){
|
||||
if [ "x${ssr_enabled}" == "x1" ] ;then
|
||||
echolog "设置ssr IP"
|
||||
for ssrname in $ssr_services
|
||||
do
|
||||
echo $ssrname
|
||||
uci set shadowsocksr.$ssrname.server="${bestip}"
|
||||
uci set shadowsocksr.$ssrname.ip="${bestip}"
|
||||
done
|
||||
uci commit shadowsocksr
|
||||
fi
|
||||
}
|
||||
|
||||
function vssr_best_ip(){
|
||||
if [ "x${vssr_enabled}" == "x1" ] ;then
|
||||
echolog "设置Vssr IP"
|
||||
for ssrname in $vssr_services
|
||||
do
|
||||
echo $ssrname
|
||||
uci set vssr.$ssrname.server="${bestip}"
|
||||
done
|
||||
uci commit vssr
|
||||
fi
|
||||
}
|
||||
|
||||
function bypass_best_ip(){
|
||||
if [ "x${bypass_enabled}" == "x1" ] ;then
|
||||
echolog "设置Bypass IP"
|
||||
for ssrname in $bypass_services
|
||||
do
|
||||
echo $ssrname
|
||||
uci set bypass.$ssrname.server="${bestip}"
|
||||
done
|
||||
uci commit bypass
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_app(){
|
||||
if [ "x${ssr_started}" == "x1" ] ;then
|
||||
if [ $proxy_mode == "close" ] ;then
|
||||
uci set shadowsocksr.@global[0].global_server="${ssr_original_server}"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set shadowsocksr.@global[0].run_mode="${ssr_original_run_mode}"
|
||||
fi
|
||||
uci commit shadowsocksr
|
||||
/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}"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set passwall.@global[0].tcp_proxy_mode="${passwall_original_run_mode}"
|
||||
fi
|
||||
uci commit passwall
|
||||
/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}"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set passwall2.@global[0].tcp_proxy_mode="${passwall2_original_run_mode}"
|
||||
fi
|
||||
uci commit passwall2
|
||||
/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}"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set vssr.@global[0].run_mode="${vssr_original_run_mode}"
|
||||
fi
|
||||
uci commit vssr
|
||||
/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}"
|
||||
elif [ $proxy_mode == "gfw" ] ;then
|
||||
uci set bypass.@global[0].run_mode="${bypass_original_run_mode}"
|
||||
fi
|
||||
uci commit bypass
|
||||
/etc/init.d/bypass restart &>/dev/null
|
||||
echolog "Bypass重启完成"
|
||||
fi
|
||||
}
|
||||
|
||||
function alidns_ip(){
|
||||
if [ "x${DNS_enabled}" == "x1" ] ;then
|
||||
get_servers_config "DNS_type" "app_key" "app_secret" "main_domain" "sub_domain" "line"
|
||||
if [ $DNS_type == "aliyu" ] ;then
|
||||
for sub in $sub_domain
|
||||
do
|
||||
/usr/bin/cloudflarespeedtest/aliddns.sh $app_key $app_secret $main_domain $sub $line $ipv6_enabled $bestip
|
||||
echolog "更新域名${sub}阿里云DNS完成"
|
||||
sleep 1s
|
||||
done
|
||||
fi
|
||||
echo "aliyun done"
|
||||
fi
|
||||
}
|
||||
|
||||
read_config
|
||||
|
||||
# 启动参数
|
||||
if [ "$1" ] ;then
|
||||
[ $1 == "start" ] && speed_test && ip_replace
|
||||
[ $1 == "test" ] && speed_test
|
||||
[ $1 == "replace" ] && ip_replace
|
||||
exit
|
||||
fi
|
|
@ -21,13 +21,13 @@ define Download/geoip
|
|||
HASH:=a17a7ad10116f2cdd7e5f5dfbfff99695641e6dddf57d35c8c32e3f07960b1ab
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20230315033339
|
||||
GEOSITE_VER:=20230314063548
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=5bf3257f15af66943714e1118ac55b76d8010fdd00aeb5b641519b3c79410205
|
||||
HASH:=bb5650cecc3abe238f3f79dd4678ddd105f13e711a311f1884cd5285bbe55d27
|
||||
endef
|
||||
|
||||
define Package/v2ray-geodata/template
|
||||
|
|
Loading…
Reference in New Issue