Skip to content

Commit

Permalink
Update mtproxy.sh
Browse files Browse the repository at this point in the history
更新nat-info
  • Loading branch information
ellermister committed Feb 2, 2020
1 parent 9de2fa0 commit 392cd15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mtproxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ run_mtp(){
echo -e "提醒:\033[33mMTProxy已经运行,请勿重复运行!\033[0m"
else
source ./mtp_config
nat_ip=`ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 awk '{print $2}' | cut -d "/" -f1`
nat_ip=$(echo $(ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | cut -d "/" -f1))
public_ip=`curl -s https://api.ip.sb/ip`
nat_info=""
if [ $nat_ip ne $public_ip ];then
nat_info="--nat-info ${nat_ip}:{$public_ip}"
fi
./mtproto-proxy -u nobody -p $web_port -H $port -S $secret --aes-pwd proxy-secret proxy-multi.conf -M 1 --domain $domain $nat_info >/dev/null 2>&1 &

echo $!>$pid_file
sleep 2
info_mtp
Expand All @@ -205,8 +207,9 @@ run_mtp(){
debug_mtp(){
cd $WORKDIR
source ./mtp_config
nat_ip=`ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 awk '{print $2}' | cut -d "/" -f1`
nat_ip=$(echo $(ip a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | cut -d "/" -f1))
public_ip=`curl -s https://api.ip.sb/ip`
nat_info=""
if [ $nat_ip ne $public_ip ];then
nat_info="--nat-info ${nat_ip}:{$public_ip}"
fi
Expand Down

0 comments on commit 392cd15

Please sign in to comment.