From cb31a68ea2163d0e2b97f660d17092a016ce00a5 Mon Sep 17 00:00:00 2001 From: LovelyHaochi Date: Sat, 21 Nov 2020 23:57:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BATAG?= =?UTF-8?q?=E6=97=B6=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=8A=B6=E6=80=81=E7=A0=81=E6=8F=90=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=97=B6=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mtproxy.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mtproxy.sh b/mtproxy.sh index c7bd6bf..7448fd8 100644 --- a/mtproxy.sh +++ b/mtproxy.sh @@ -165,8 +165,7 @@ config_mtp(){ read -p "(默认域名: ${default_domain}):" input_domain [ -z "${input_domain}" ] && input_domain=${default_domain} http_code=$(curl -I -m 10 -o /dev/null -s -w %{http_code} $input_domain) - echo "状态码:$http_code" - if [ $http_code -eq "200" ] || [ $http_code -eq "302" ]; then + if [ $http_code -eq "200" ] || [ $http_code -eq "302" ] || [ $http_code -eq "301" ]; then echo echo "---------------------------" echo "伪装域名 = ${input_domain}" @@ -174,15 +173,23 @@ config_mtp(){ echo break fi - echo -e "[\033[33m错误\033[0m] 域名无法访问,请重新输入或更换域名!" + echo -e "[\033[33m状态码:${http_code}错误\033[0m] 域名无法访问,请重新输入或更换域名!" done + + # config info + public_ip=$(curl -s https://api.ip.sb/ip --ipv4) + [ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4) + secret=$(head -c 16 /dev/urandom | xxd -ps) # proxy tag while true do default_tag="" echo -e "请输入你需要推广的TAG:" - echo -e "若没有,请联系 @MTProxybot 进一步创建你的TAG" + echo -e "若没有,请联系 @MTProxybot 进一步创建你的TAG, 可能需要信息如下:" + echo -e "IP: ${public_ip}" + echo -e "PORT: ${input_port}" + echo -e "SECRET(可以随便填): ${secret}" read -p "(留空则跳过):" input_tag [ -z "${input_tag}" ] && input_tag=${default_tag} if [ -z "$input_tag" ] || [[ "$input_tag" =~ ^[A-Za-z0-9]{32}$ ]]; then @@ -198,7 +205,6 @@ config_mtp(){ curl -s https://core.telegram.org/getProxySecret -o proxy-secret curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf - secret=$(head -c 16 /dev/urandom | xxd -ps) cat >./mtp_config <