Code Monkey home page Code Monkey logo

mtproxy-docker's Introduction

Docker

MTProxy-Docker


Simple MT-Proto proxy ONLY FOR x86_64 SYSTEMS

Requirements

  • VPS outside a country that blocked Telegram
  • Minimum knowledge about docker and/or docker compose
  • Read this entire README, the link at the end and understand what this project does

With docker compose

Default settings

  • Run docker compose up -d

Custom settings

If you want to customize an environment, create a .env file replacing the follow default values:

Environment Default value
SECRET ec4dd80983dbf12d6b354cf7bcfe9a48
WORKERS 1
MTPROTO_REPO_URL https://github.com/TelegramMessenger/MTProxy
TZ

An alternative to MTPROTO_REPO_URL is https://github.com/GetPageSpeed/MTProxy that is a fork from MTProxy with patches applied.

To more informations read the follow session.

Building without docker compose


You can specify two arguments when building an image.

  1. --build-arg WORKERS= (1 is the number of workers. You can increase the number of workers, if you have a powerful server.)

  2. --build-arg SECRET= (Default is ec4dd80983dbf12d6b354cf7bcfe9a48) To generate a random secret, run the following command:

head -c 16 /dev/urandom | xxd -ps
git clone https://github.com/Dofamin/MTProxy-Docker.git /srv/MTProxy/

docker build /srv/MTProxy/ --tag mtproxy 

docker rm --force MTProxy

docker create \
  --name=MTProxy \
  -p 443:8889 \
  -e SECRET=ec4dd80983dbf12d6b354cf7bcfe9a48 \
  -e WORKERS=1 \
  --privileged \
  --restart unless-stopped \
  --memory="100m" \
  mtproxy:latest

docker start MTProxy

Or just pull from GitHub

docker pull ghcr.io/dofamin/mtproxy-docker:main

docker rm --force MTProxy

docker create \
  --name=MTProxy \
  -p 443:8889 \
  -e SECRET=ec4dd80983dbf12d6b354cf7bcfe9a48 \
  -e WORKERS=1 \
  --privileged \
  --restart unless-stopped \
  --memory="100m" \
  ghcr.io/dofamin/mtproxy-docker:main

docker start MTProxy

Random padding


Due to some ISPs detecting MTProxy by packet sizes, random padding is added to packets if such mode is enabled.

It's only enabled for clients which request it.

Add dd prefix to secret (cafe...babe => ddcafe...babe) to enable this mode on client side.

Troubleshooting


MTProto Proxy may fail to operate properly in certain conditions. There are two major problem categories: the client might not be able to connect to your proxy server (client applications will hang in "connecting" state), or your proxy server is unable to connect to the core Telegram servers (application hangs in "updating" state).

"Connecting" problems are usually caused by a misconfigured firewall, a Docker port forwarding problem, a state censorship issue, or a combination of the above.

If clients hang in an "updating" state, be sure to check the following:

1.Firewalls and/or DPI checkpoints between your proxy server and the core Telegram servers may not allow traffic to pass. Check your local firewall first.

2.Your proxy server's system time should be within five seconds of UTC. You should be running a time synchronization daemon to keep these issues to a minimum.

3.The MTProto Proxy must know about its globally routable external IP address if it's behind NAT. The container tries to detect the external IP address automatically, but this may fail if you have extracted the binary out of the container. Use mtproto-proxy --nat-info command line switch to configure the proxy server.


mtproxy-docker's People

Contributors

dofamin avatar vitormattos avatar

Stargazers

Néstor Lora avatar

Watchers

Néstor Lora avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.