mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-15 03:25:42 +08:00
Fix the bug of IP display error when uninstalling.
Former-commit-id: 330ee534347695d4f81dd28bc1814b6c365f09a6
This commit is contained in:
Binary file not shown.
@@ -1 +0,0 @@
|
||||
0ffd51a0bda3f202ad6e6e4f4e614a23855e70b0
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
f78879c9e88395cfd016c305365b9208657caa5b
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
8a256426ef672f201ca5bf127bdadb202e0d5623
|
||||
@@ -539,14 +539,15 @@ ip_info() {
|
||||
elif [[ "$2" =~ ^[[:alnum:]]+$ ]]; then
|
||||
local INTERFACE_SOCK5="--interface $2"
|
||||
fi
|
||||
local IS_UNINSTALL="$3"
|
||||
|
||||
[ "$L" = 'C' ] && IS_CHINESE=${IS_CHINESE:-'?lang=zh-CN'}
|
||||
[ "$CHECK_46" = '6' ] && CHOOSE_IP_API='https://api-ipv6.ip.sb/geoip' || CHOOSE_IP_API='https://api-ipv4.ip.sb/geoip'
|
||||
IP_TRACE=$(curl --retry 2 -ksm5 $INTERFACE_SOCK5 https://www.cloudflare.com/cdn-cgi/trace | awk -F '=' '/^warp=/{print $NF}')
|
||||
if [ -n "$IP_TRACE" ]; then
|
||||
local API_IP=$(curl --retry 2 -ksm5 $INTERFACE_SOCK5 --user-agent Mozilla $CHOOSE_IP_API | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ -n "$API_IP" ] && local IP_JSON=$(curl --retry 2 -ksm5 --user-agent Mozilla https://ip.forvps.gq/${API_IP}${IS_CHINESE})
|
||||
IP_JSON=${IP_JSON:-"$(curl --retry 3 -ks${CHECK_46}m5 $INTERFACE_SOCK5 --user-agent Mozilla $https://ifconfig.co/json)"}
|
||||
[ "$IS_UNINSTALL" = 'is_uninstall' ] && local API_IP=$(curl -$CHECK_46 --retry 2 -ksm5 --user-agent Mozilla https://api.ip.sb/ip) || local API_IP=$(curl --retry 2 -ksm5 $INTERFACE_SOCK5 --user-agent Mozilla $CHOOSE_IP_API | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ -n "$API_IP" ] && local IP_JSON=$(curl --retry 2 -ksm5 https://ip.forvps.gq/${API_IP}${IS_CHINESE})
|
||||
IP_JSON=${IP_JSON:-"$(curl --retry 3 -ks${CHECK_46}m5 $INTERFACE_SOCK5 --user-agent Mozilla https://ifconfig.co/json)"}
|
||||
|
||||
if [ -n "$IP_JSON" ]; then
|
||||
local WAN=$(sed -En 's/.*"(ip|query)":[ ]*"([^"]+)".*/\2/p' <<< "$IP_JSON")
|
||||
@@ -566,8 +567,9 @@ ip_case() {
|
||||
|
||||
if [ "$CHECK_TYPE" = "warp" ]; then
|
||||
fetch_4() {
|
||||
unset IP_RESULT4 COUNTRY4 ASNORG4 TRACE4
|
||||
local IP_RESULT4=$(ip_info 4 $CHECK_NONGLOBAL)
|
||||
unset IP_RESULT4 COUNTRY4 ASNORG4 TRACE4 IS_UNINSTALL
|
||||
local IS_UNINSTALL=${IS_UNINSTALL:-"$1"}
|
||||
local IP_RESULT4=$(ip_info 4 "$CHECK_NONGLOBAL" "$IS_UNINSTALL")
|
||||
TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*')
|
||||
WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*')
|
||||
COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*')
|
||||
@@ -575,8 +577,9 @@ ip_case() {
|
||||
}
|
||||
|
||||
fetch_6() {
|
||||
unset IP_RESULT6 COUNTRY6 ASNORG6 TRACE6
|
||||
local IP_RESULT6=$(ip_info 6 $CHECK_NONGLOBAL)
|
||||
unset IP_RESULT6 COUNTRY6 ASNORG6 TRACE6 IS_UNINSTALL
|
||||
local IS_UNINSTALL=${IS_UNINSTALL:-"$1"}
|
||||
local IP_RESULT6=$(ip_info 6 "$CHECK_NONGLOBAL" "$IS_UNINSTALL")
|
||||
TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*')
|
||||
WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*')
|
||||
COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*')
|
||||
@@ -596,6 +599,11 @@ ip_case() {
|
||||
fetch_4
|
||||
fetch_6
|
||||
fi
|
||||
;;
|
||||
u )
|
||||
# 卸载的话,使用不同的 IP api
|
||||
fetch_4 is_uninstall
|
||||
fetch_6 is_uninstall
|
||||
esac
|
||||
elif [ "$CHECK_TYPE" = "wireproxy" ]; then
|
||||
fetch_4() {
|
||||
@@ -1141,7 +1149,7 @@ uninstall() {
|
||||
|
||||
# 显示卸载结果
|
||||
systemctl restart systemd-resolved >/dev/null 2>&1; sleep 3
|
||||
ip_case d warp
|
||||
ip_case u warp
|
||||
info " $(text 45)\n IPv4: $WAN4 $COUNTRY4 $ASNORG4\n IPv6: $WAN6 $COUNTRY6 $ASNORG6 "
|
||||
}
|
||||
|
||||
|
||||
+9
-7
@@ -409,11 +409,12 @@ check_install() {
|
||||
|
||||
# 检测 IPv4 IPv6 信息,WARP Ineterface 开启,普通还是 Plus账户 和 IP 信息
|
||||
ip4_info() {
|
||||
unset IP4_JSON COUNTRY4 ASNORG4 TRACE4
|
||||
unset IP4_JSON COUNTRY4 ASNORG4 TRACE4 IS_UNINSTALL
|
||||
IS_UNINSTALL="$1"
|
||||
[ "$L" = 'C' ] && IS_CHINESE=${IS_CHINESE:-'?lang=zh-CN'}
|
||||
TRACE4=$(curl --retry 5 -ks4m5 https://www.cloudflare.com/cdn-cgi/trace $INTERFACE4 | awk -F '=' '/^warp=/{print $NF}')
|
||||
TRACE4=$(curl --retry 2 -ks4m5 https://www.cloudflare.com/cdn-cgi/trace $INTERFACE4 | awk -F '=' '/^warp=/{print $NF}')
|
||||
if [ -n "$TRACE4" ]; then
|
||||
WAN4=$(curl --retry 5 -ks4m5 -A Mozilla https://api-ipv4.ip.sb/geoip $INTERFACE4 | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ "$IS_UNINSTALL" = 'is_uninstall' ] && WAN4=$(curl -4 --retry 2 -ksm5 --user-agent Mozilla https://api.ip.sb/ip) || WAN4=$(curl --retry 2 -ks4m5 -A Mozilla https://api-ipv4.ip.sb/geoip $INTERFACE4 | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ -n "$WAN4" ] && IP4_JSON=$(curl --retry 2 -ksm5 --user-agent Mozilla https://ip.forvps.gq/${WAN4}${IS_CHINESE})
|
||||
IP4_JSON=${IP4_JSON:-"$(curl --retry 2 -ks4m3 --user-agent Mozilla https://ifconfig.co/json $INTERFACE4)"}
|
||||
if [ -n "$IP4_JSON" ]; then
|
||||
@@ -424,11 +425,12 @@ ip4_info() {
|
||||
}
|
||||
|
||||
ip6_info() {
|
||||
unset IP6_JSON COUNTRY6 ASNORG6 TRACE6
|
||||
unset IP6_JSON COUNTRY6 ASNORG6 TRACE6 IS_UNINSTALL
|
||||
IS_UNINSTALL="$1"
|
||||
[ "$L" = 'C' ] && IS_CHINESE=${IS_CHINESE:-'?lang=zh-CN'}
|
||||
TRACE6=$(curl --retry 5 -ks6m5 https://www.cloudflare.com/cdn-cgi/trace $INTERFACE6 | awk -F '=' '/^warp=/{print $NF}')
|
||||
if [ -n "$TRACE6" ]; then
|
||||
WAN6=$(curl --retry 5 -ks6m5 -A Mozilla https://api-ipv6.ip.sb/geoip $INTERFACE6 | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ "$IS_UNINSTALL" = 'is_uninstall' ] && WAN6=$(curl -6 --retry 2 -ksm5 --user-agent Mozilla https://api.ip.sb/ip) || WAN6=$(curl --retry 5 -ks6m5 -A Mozilla https://api-ipv6.ip.sb/geoip $INTERFACE6 | sed 's/.*"ip":"\([^"]\+\)".*/\1/')
|
||||
[ -n "$WAN6" ] && IP6_JSON=$(curl --retry 2 -ksm5 --user-agent Mozilla https://ip.forvps.gq/${WAN6}${IS_CHINESE})
|
||||
IP6_JSON=${IP6_JSON:-"$(curl --retry 2 -ks6m3 --user-agent Mozilla https://ifconfig.co/json $INTERFACE6)"}
|
||||
if [ -n "$IP6_JSON" ]; then
|
||||
@@ -611,8 +613,8 @@ uninstall() {
|
||||
[ -s /opt/warp-go/tun.sh ] && rm -f /opt/warp-go/tun.sh && sed -i '/tun.sh/d' /etc/crontab
|
||||
|
||||
# 显示卸载结果
|
||||
ip4_info
|
||||
ip6_info
|
||||
ip4_info is_uninstall
|
||||
ip6_info is_uninstall
|
||||
info " $(text 17)\n IPv4: $WAN4 $COUNTRY4 $ASNORG4\n IPv6: $WAN6 $COUNTRY6 $ASNORG6 "
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
49b8240690e862286c9ba8044e17b5156b9982c0
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
e4d9f533b23d4df585996cf28ae7cdf350705340
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ce08d7f2f5591b8cc596a165da6831c701e96598
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9f76d19fe73daf0c9a0a7aff893cfb658fbe5adf
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
43081bc02dceb309176ece9bc1b605893eb9f283
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9b5f39dbb7269fffdb3ee70ed61f84a80f2a0b18
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
ea572e47995ca4b3d178e0c14b3092f8d9e57a1b
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6735cf684ba50ae34c76f8830b0478ffbfb7546e
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
26db70b721569b8232b74a083f6eef469c0e428c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
a4ecf4dbd94dcdfdacfbdb36302eaafebacb6ccf
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6e2b65a0675b35607e1e895daa8c6147db3df887
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
dfc46360cf5057d6308e33218524671da72564d6
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
d4aaa8aadfecb459ac2438212a45a7e2254c384e
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6093dce8386bf224e0da67929ca3820aa51abec9
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9a69cb38ff0085a2d91b4c22af9ec49c43306f72
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
c2d58ffc562d51f07dc75974d8b75725808d4f87
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
f43a036953991f514939c37166efa9d783623da9
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
7679aa23bd4a5f9f92f33f6c80364ff54f30830e
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
68d38c9cb37290646061f044501bf2c54b140b26
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
3a593882a3a54fb8a0b52b6909b368ee058c08d9
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
e656d2e11f3a417c838951283a3e2b77dc71123b
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
e2c36af963da2aaa9557ba758e4a2734852b1356
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
114b44bbfda037a694e661ccc30193e20c420e6c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
d094e3f36e6217e555725c2231fb35bad570d7c3
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
baf6a616925028095f6520bb4073e2841144b498
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
25d8bff64809f6de693f2b7ba8fbc08074cf9197
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
20ffed20421bebadf6bc1f4096f81d1f74c26744
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
24e3c37f4da1a961729b92d7fa894c14b5e76c05
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
2da642005431e555a71d5a52b45595b94086b009
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
a55665d3340f0c8c48549020fe9ac365655b99c1
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9c0e94bdb4f70ca58ba39ffe2c2173d61f1fb2af
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9850bdabf55488d3fe72f09e98db29dc7fbde6bb
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6f84b4c2cb8d4c86478429e4090047144fc2efba
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
0bf50a18a591e55d33de2c575fd3c9797984fec5
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
8dfa07fa4cd214a9614646bf1a8d1b9133aacc8b
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
8f41b875d3508a1f6728a266ecd4b4247761f5a5
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
e80e9783974e72af73b8265e740681e7d5a2516b
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
4c67290e3928d20fe8224a221faba5bf6e15f736
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
f4029884fc28e0728dacc69b85f31c09bf1a9ffd
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
1b4c10d618cf2f6e20e6da8e135d5cc7fa48c5eb
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
c066f75f38151009fb9bd7ab5444448d5016ba39
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
9d10f40dd4e87c4b198b61efaa9065f577185fbe
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
5e63c7468af8b9007feab091a9a34f84b7fe6a22
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
a56cb310c3468a9f500c083176c912e81acdd5fc
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
da773eb03a5d37380d875570cbad03ca3c989a0c
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
1e1dc9c40b6d50dbd50ac45418eac8538370a7db
|
||||
Reference in New Issue
Block a user