Skip to content

Commit

Permalink
Add specify provider parameters during docker runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
ellermister committed Nov 26, 2023
1 parent 7ecb97e commit 3d7c18a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions mtproxy-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ set_config(){
sed -i 's/proxy_tag="[0-9A-Za-z]*"/proxy_tag="'$tag'"/' $mtp_config
fi
if [ "$domain" ]; then
sed -i 's/domain="[A-z\.\-\d]*"/domain="'$domain'"/' $mtp_config
sed -i 's/domain="[A-z\.\-0-9]*"/domain="'$domain'"/' $mtp_config
fi
if [ "$provider" ] && [[ "$provider" =~ ^[1-2]$ ]]; then
sed -i 's/provider=[0-9]\+/provider='$provider'/' $mtp_config
fi
}

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

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

echo $ip_white_list > /var/ip_white_list
set_config
fi;

set_config
echo "=================================================="
echo -e "Default port is \033[31m443\033[0m by docker started mtproxy!!!"
echo "=================================================="
cd /home/mtproxy
curl -s https://core.telegram.org/getProxySecret -o proxy-secret
curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
bash /home/mtproxy/mtproxy.sh start
2 changes: 1 addition & 1 deletion mtproxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ function get_run_command(){

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

0 comments on commit 3d7c18a

Please sign in to comment.