Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
.DS_Store
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ vi /etc/crontab

@reboot root nohup bash /home/mtproxy/mtproxy.sh start > /dev/null 2>&1 &
```

## 服务器设置

如果启动后如果无法访问,请检查一下服务器的端口是否打开了
以下以centos7 为例
```bash
firewall-cmd --zone=public --add-port={your_port}/tcp --permanet
systemctl restart firewalld.service
firewalld-cmd --list-ports
```
16 changes: 8 additions & 8 deletions mtproxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ config_mtp(){
done

# config info
public_ip=$(curl -s https://api.ip.sb/ip --ipv4)
[ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4)
public_ip=$(curl -s ip.sb --ipv4)
[ -z "$public_ip" ] && public_ip=$(curl -s ip.sb --ipv4)
secret=$(head -c 16 /dev/urandom | xxd -ps)

# proxy tag
Expand Down Expand Up @@ -230,8 +230,8 @@ info_mtp(){
status_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)
public_ip=$(curl -s ip.sb --ipv4)
[ -z "$public_ip" ] && public_ip=$(curl -s ip.sb --ipv4)
domain_hex=$(xxd -pu <<< $domain | sed 's/0a//g')
client_secret="ee${secret}${domain_hex}"
echo -e "TMProxy+TLS代理: \033[32m运行中\033[0m"
Expand All @@ -255,16 +255,16 @@ run_mtp(){
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
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)
public_ip=`curl -s ip.sb --ipv4`
[ -z "$public_ip" ] && public_ip=$(curl -s ip.sb --ipv4)
nat_info=""
if [[ $nat_ip != $public_ip ]];then
nat_info="--nat-info ${nat_ip}:${public_ip}"
fi
tag_arg=""
[[ -n "$proxy_tag" ]] && tag_arg="-P $proxy_tag"
./mtproto-proxy -u nobody -p $web_port -H $port -S $secret --aes-pwd proxy-secret proxy-multi.conf -M 1 $tag_arg --domain $domain $nat_info >/dev/null 2>&1 &

echo $!>$pid_file
sleep 2
info_mtp
Expand All @@ -275,7 +275,7 @@ debug_mtp(){
cd $WORKDIR
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`
public_ip=`curl -s ip.sb --ipv4`
[ -z "$public_ip" ] && public_ip=$(curl -s ipinfo.io/ip --ipv4)
nat_info=""
if [[ $nat_ip != $public_ip ]];then
Expand Down