support ipv6
This commit is contained in:
29
install.sh
29
install.sh
@@ -742,18 +742,18 @@ domain_check() {
|
||||
# $cmd install dnsutils -y
|
||||
# fi
|
||||
# test_domain=$(dig $domain +short)
|
||||
# test_domain=$(ping $domain -c 1 -4 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}")
|
||||
test_domain=$(ping $domain -c 1 -W 2 | head -1)
|
||||
# test_domain=$(wget -qO- --header='accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$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=$domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1)
|
||||
if [[ $test_domain != $ip ]]; then
|
||||
# test_domain=$(curl -sH 'accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1)
|
||||
if [[ ! $(echo $test_domain | grep $ip) ]]; then
|
||||
echo
|
||||
echo -e "$red 检测域名解析错误....$none"
|
||||
echo
|
||||
echo -e " 你的域名: $yellow$domain$none 未解析到: $cyan$ip$none"
|
||||
echo
|
||||
echo -e " 你的域名当前解析到: $cyan$test_domain$none"
|
||||
echo -e " PING 测试结果: $cyan$test_domain$none"
|
||||
echo
|
||||
echo "备注...如果你的域名是使用 Cloudflare 解析的话..在 Status 那里点一下那图标..让它变灰"
|
||||
echo "备注...如果你的域名是使用 Cloudflare 解析的话..在 DNS 那, 将 (Proxy status / 代理状态), 设置成 (DNS only / 仅限 DNS)"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
@@ -878,15 +878,16 @@ backup_config() {
|
||||
}
|
||||
|
||||
get_ip() {
|
||||
ip=$(curl -s https://ipinfo.io/ip)
|
||||
[[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip)
|
||||
[[ -z $ip ]] && ip=$(curl -s https://api.ipify.org)
|
||||
[[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org)
|
||||
[[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip)
|
||||
[[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
|
||||
[[ -z $ip ]] && ip=$(curl -s icanhazip.com)
|
||||
[[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
|
||||
[[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit
|
||||
# ip=$(curl -s https://ipinfo.io/ip)
|
||||
# [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip)
|
||||
# [[ -z $ip ]] && ip=$(curl -s https://api.ipify.org)
|
||||
# [[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org)
|
||||
# [[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip)
|
||||
# [[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
|
||||
# [[ -z $ip ]] && ip=$(curl -s icanhazip.com)
|
||||
# [[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
|
||||
export "$(wget -qO- https://dash.cloudflare.com/cdn-cgi/trace | grep ip=)" >/dev/null 2>&1
|
||||
[[ -z $ip ]] && echo -e "\n$red 获取IP失败, 这垃圾小鸡扔了吧!$none\n" && exit
|
||||
}
|
||||
|
||||
error() {
|
||||
|
Reference in New Issue
Block a user