forked from crazypeace/v2ray_wss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetip.sh
34 lines (29 loc) · 1.41 KB
/
getip.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 本脚本使用
ip=$(curl -s https://api.myip.la)
# from https://github.com/wangxiaoke123/233v2ray
get_ip() {
ipv4=$(curl -4 -s ipv4.icanhazip.com)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 https://api.ip.sb/ip)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 https://api.ipify.org)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 https://ip.seeip.org)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 https://ifconfig.co/ip)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 icanhazip.com)
[[ -z $ipv4 ]] && ipv4=$(curl -s -4 myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ipv4 ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n"
ipv6=$(curl -6 -s ipv6.icanhazip.com)
[[ -z $ipv6 ]] && ipv6=$(curl -s -6 https://api.ip.sb/ip)
[[ -z $ipv6 ]] && ipv6=$(curl -s -6 https://ip.seeip.org)
[[ -z $ipv6 ]] && ipv6=$(curl -s -6 https://ifconfig.co/ip)
[[ -z $ipv6 ]] && ipv6=$(curl -s -6 icanhazip.com)
[[ -z $ipv6 ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n"
if [ $ipv6 ]; then
ip=$ipv6 ##默认ipv6 edit by Scaleya
else ip=$ipv4
fi
}
# from https://owo.misaka.rest/xui-routing/
curl ipget.net
# from https://github.com/233boy/v2ray
curl -s https://www.cloudflare.com/cdn-cgi/trace | grep ip= | sed -e "s/ip=//g"
# https://www.cloudflare.com/cdn-cgi/trace 返回的结果里面还有一个warp,可以用于判断是否通过warp访问的