update: caddy1 to caddy2

This commit is contained in:
233boy
2022-05-25 22:19:43 +08:00
parent 7f76440136
commit 9c63512887
15 changed files with 125 additions and 364 deletions

View File

@@ -10,7 +10,7 @@ none='\e[0m'
# Root
[[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1
_version="v3.53"
_version="v3.54"
cmd="apt-get"
@@ -96,6 +96,23 @@ if [[ ! $(grep 'v2ray.vmess.aead.forced=false' /lib/systemd/system/v2ray.service
systemctl restart v2ray
fi
# fix caddy2 config
if [[ $caddy ]]; then
/usr/local/bin/caddy version >/dev/null 2>&1
if [[ $? == 1 ]]; then
echo -e "\n $yellow 警告: 脚本将自动更新 Caddy 版本。 $none \n"
systemctl stop caddy
_load download-caddy.sh
_download_caddy_file
_install_caddy_service
systemctl daemon-reload
_load caddy-config.sh
systemctl restart caddy
echo -e "\n $green 更新 Caddy 版本完成, 要是出问题了你可以重装解决。 $none \n"
exit 0
fi
fi
if [[ $v2ray_ver != v* ]]; then
v2ray_ver="v$v2ray_ver"
fi
@@ -1737,7 +1754,7 @@ change_proxy_site_config() {
}
domain_check() {
# test_domain=$(dig $new_domain +short)
test_domain=$(ping $new_domain -c 1 -4 -W 2| grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}")
test_domain=$(ping $new_domain -c 1 -4 -W 2 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}")
# test_domain=$(wget -qO- --header='accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$new_domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1)
# test_domain=$(curl -sH 'accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$new_domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1)
if [[ $test_domain != $ip ]]; then