Skip to content

Commit

Permalink
fix get ip err
Browse files Browse the repository at this point in the history
  • Loading branch information
233boy committed Aug 8, 2023
1 parent 8eb73d4 commit 88aa4ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ download() {

# get server ip
get_ip() {
export "$(_wget -4 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ -z $ip ]] && export "$(_wget -6 -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://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
}

# check background tasks status
Expand Down
6 changes: 3 additions & 3 deletions src/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ get_uuid() {

get_ip() {
[[ $ip || $is_no_auto_tls || $is_gen ]] && return
export "$(_wget -4 -qO- https://cloudflare-dns.com/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ ! $ip ]] && export "$(_wget -6 -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://one.one.one.one/cdn-cgi/trace | grep ip=)" &>/dev/null
[[ ! $ip ]] && {
err "获取服务器 IP 失败.."
}
Expand Down Expand Up @@ -1383,7 +1383,7 @@ get() {
# is_host_dns=$(ping $host $is_ip_type -c 1 -W 2 | head -1)
is_dns_type="a"
[[ $(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)
msg "\n 提醒: 按 $(_green Ctrl + C) 退出\n"
Expand Down
2 changes: 1 addition & 1 deletion xray.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

args=$@
is_sh_ver=v1.14
is_sh_ver=v1.15

. /etc/xray/sh/src/init.sh

0 comments on commit 88aa4ac

Please sign in to comment.