From ead80b5e6410b2e2560b3d5aca4db796556b021c Mon Sep 17 00:00:00 2001 From: chauncey Date: Sat, 13 Jun 2020 14:52:36 +0800 Subject: [PATCH] Update mtproxy.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加获取备用公网IP接口 --- mtproxy.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mtproxy.sh b/mtproxy.sh index 8ef311c..0ec1ae4 100644 --- a/mtproxy.sh +++ b/mtproxy.sh @@ -213,6 +213,7 @@ info_mtp(){ if [ $? == 1 ];then source ./mtp_config public_ip=$(curl -s https://api.ip.sb/ip --ipv4) + [ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4) domain_hex=$(xxd -pu <<< $domain | sed 's/0a//g') client_secret="ee${secret}${domain_hex}" echo -e "TMProxy+TLS代理: \033[32m运行中\033[0m" @@ -236,6 +237,7 @@ run_mtp(){ source ./mtp_config nat_ip=$(echo $(ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | cut -d "/" -f1 |awk 'NR==1 {print $1}')) public_ip=`curl -s https://api.ip.sb/ip --ipv4` + [ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4) nat_info="" if [[ $nat_ip != $public_ip ]];then nat_info="--nat-info ${nat_ip}:${public_ip}" @@ -255,6 +257,7 @@ debug_mtp(){ source ./mtp_config nat_ip=$(echo $(ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | cut -d "/" -f1 |awk 'NR==1 {print $1}')) public_ip=`curl -s https://api.ip.sb/ip --ipv4` + [ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4) nat_info="" if [[ $nat_ip != $public_ip ]];then nat_info="--nat-info ${nat_ip}:${public_ip}"