Skip to content

Commit 3d7c18a

Browse files
committed
Add specify provider parameters during docker runtime
1 parent 7ecb97e commit 3d7c18a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

mtproxy-entrypoint.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ set_config(){
2222
sed -i 's/proxy_tag="[0-9A-Za-z]*"/proxy_tag="'$tag'"/' $mtp_config
2323
fi
2424
if [ "$domain" ]; then
25-
sed -i 's/domain="[A-z\.\-\d]*"/domain="'$domain'"/' $mtp_config
25+
sed -i 's/domain="[A-z\.\-0-9]*"/domain="'$domain'"/' $mtp_config
26+
fi
27+
if [ "$provider" ] && [[ "$provider" =~ ^[1-2]$ ]]; then
28+
sed -i 's/provider=[0-9]\+/provider='$provider'/' $mtp_config
2629
fi
2730
}
2831

2932
if [ ! -f $mtp_config ];then
3033
cp "${default_config}" "$mtp_config"
3134

35+
# if params is empty, then generate random values
3236
if [ ! "$secret" ]; then
3337
secret=$(gen_rand_hex 32)
3438
fi
@@ -42,14 +46,11 @@ if [ ! -f $mtp_config ];then
4246
fi
4347

4448
echo $ip_white_list > /var/ip_white_list
45-
set_config
4649
fi;
4750

4851
set_config
4952
echo "=================================================="
5053
echo -e "Default port is \033[31m443\033[0m by docker started mtproxy!!!"
5154
echo "=================================================="
5255
cd /home/mtproxy
53-
curl -s https://core.telegram.org/getProxySecret -o proxy-secret
54-
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
5556
bash /home/mtproxy/mtproxy.sh start

mtproxy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ function get_run_command(){
427427

428428
# ./mtg simple-run -n 1.1.1.1 -t 30s -a 512kib 0.0.0.0:$port $client_secret >/dev/null 2>&1 &
429429
[[ -f "./mtg" ]] || (echo -e "提醒:\033[33m MTProxy 代理程序不存在请重新安装! \033[0m" && exit 1)
430-
echo "./mtg run $client_secret $proxy_tag -b 0.0.0.0:$port --multiplex-per-connection 500 --prefer-ip=ipv6 -t $local_ip:3129"
430+
echo "./mtg run $client_secret $proxy_tag -b 0.0.0.0:$port --multiplex-per-connection 500 --prefer-ip=ipv6 -t $local_ip:$web_port"
431431
else
432432
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
433433
curl -s https://core.telegram.org/getProxySecret -o proxy-secret

0 commit comments

Comments
 (0)