fix get ip err

This commit is contained in:
233boy
2023-08-08 15:12:44 +08:00
parent 83d1e045a9
commit 463ff482ea
3 changed files with 6 additions and 6 deletions

View File

@@ -189,8 +189,8 @@ download() {
# get server ip # get server ip
get_ip() { get_ip() {
export "$(_wget -4 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null export "$(_wget -4 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ -z $ip ]] && export "$(_wget -6 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null [[ -z $ip ]] && export "$(_wget -6 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
} }
# check background tasks status # check background tasks status

View File

@@ -125,8 +125,8 @@ get_uuid() {
get_ip() { get_ip() {
[[ $ip || $is_no_auto_tls || $is_gen ]] && return [[ $ip || $is_no_auto_tls || $is_gen ]] && return
export "$(_wget -4 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null export "$(_wget -4 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ ! $ip ]] && export "$(_wget -6 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null [[ ! $ip ]] && export "$(_wget -6 -qO- https://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ ! $ip ]] && { [[ ! $ip ]] && {
err "获取服务器 IP 失败.." err "获取服务器 IP 失败.."
} }
@@ -1388,7 +1388,7 @@ get() {
# is_host_dns=$(ping $host $is_ip_type -c 1 -W 2 | head -1) # is_host_dns=$(ping $host $is_ip_type -c 1 -W 2 | head -1)
is_dns_type="a" is_dns_type="a"
[[ $(grep ":" <<<$ip) ]] && is_dns_type="aaaa" [[ $(grep ":" <<<$ip) ]] && is_dns_type="aaaa"
is_host_dns=$(_wget -qO- --header="accept: application/dns-json" "https://cloudflare-dns.com/dns-query?name=$host&type=$is_dns_type") is_host_dns=$(_wget -qO- --header="accept: application/dns-json" "https://one.one.one.one/dns-query?name=$host&type=$is_dns_type")
;; ;;
log | logerr) log | logerr)
msg "\n 提醒: 按 $(_green Ctrl + C) 退出\n" msg "\n 提醒: 按 $(_green Ctrl + C) 退出\n"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
args=$@ args=$@
is_sh_ver=v4.13 is_sh_ver=v4.14
. /etc/v2ray/sh/src/init.sh . /etc/v2ray/sh/src/init.sh