Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

run-mtg.sh 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. set -eu -o pipefail
  3. IMAGE_NAME="nineseconds/mtg"
  4. CONTAINER_NAME="mtg"
  5. SECRET_PATH="$HOME/.mtg.secret"
  6. PROXY_PORT=444
  7. STAT_PORT=3129
  8. [[ -e "$SECRET_PATH" ]] || (
  9. openssl rand -hex 16 > "$SECRET_PATH"
  10. chmod 0400 "$SECRET_PATH"
  11. )
  12. docker pull "$IMAGE_NAME"
  13. docker ps --filter "Name=$CONTAINER_NAME" -aq | xargs -r docker rm -fv
  14. docker run \
  15. -d \
  16. --name "$CONTAINER_NAME" \
  17. --sysctl 'net.ipv4.ip_local_port_range=10000 65000' \
  18. --sysctl net.ipv4.tcp_congestion_control=bbr \
  19. --sysctl net.ipv4.tcp_fastopen=3 \
  20. --sysctl net.ipv4.tcp_fin_timeout=30 \
  21. --sysctl net.ipv4.tcp_keepalive_time=1200 \
  22. --sysctl net.ipv4.tcp_max_syn_backlog=4096 \
  23. --sysctl net.ipv4.tcp_max_tw_buckets=5000 \
  24. --sysctl net.ipv4.tcp_mtu_probing=1 \
  25. --sysctl 'net.ipv4.tcp_rmem=4096 87380 67108864' \
  26. --sysctl net.ipv4.tcp_syncookies=1 \
  27. --sysctl net.ipv4.tcp_tw_reuse=1 \
  28. --sysctl 'net.ipv4.tcp_wmem=4096 65536 67108864' \
  29. --ulimit nofile=51200:51200 \
  30. --restart=unless-stopped \
  31. -p $PROXY_PORT:3128 \
  32. -p $STAT_PORT:3129 \
  33. "$IMAGE_NAME" "$(cat "$SECRET_PATH")"