prefer ipv4, fix #995 #996

old
233boy 2 years ago
parent e46b51a8cf
commit e54dceae44
  1. 3
      install.sh
  2. 5
      v2ray.sh

@ -886,7 +886,8 @@ get_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
export "$(wget -4 -qO- https://dash.cloudflare.com/cdn-cgi/trace | grep ip=)" >/dev/null 2>&1
[[ -z $ip ]] && export "$(wget -6 -qO- https://dash.cloudflare.com/cdn-cgi/trace | grep ip=)" >/dev/null 2>&1
[[ -z $ip ]] && echo -e "\n$red 获取IP失败, 这垃圾小鸡扔了吧!$none\n" && exit
}

@ -10,7 +10,7 @@ none='\e[0m'
# Root
[[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1
_version="old-v0.11"
_version="old-v0.12"
v2ray_latest_ver=v4.45.2
cmd="apt-get"
@ -2548,7 +2548,8 @@ get_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
export "$(wget -4 -qO- https://dash.cloudflare.com/cdn-cgi/trace | grep ip=)" >/dev/null 2>&1
[[ -z $ip ]] && export "$(wget -6 -qO- https://dash.cloudflare.com/cdn-cgi/trace | grep ip=)" >/dev/null 2>&1
[[ -z $ip ]] && echo -e "\n$red 获取IP失败, 这垃圾小鸡扔了吧!$none\n" && exit
}

Loading…
Cancel
Save