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
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
9seconds 607f4f42c4 Add intermediate secure wrapper il y a 7 ans
client Add intermediate secure wrapper il y a 7 ans
config Show correct secrets il y a 7 ans
mtproto Quickfix for secure mode il y a 7 ans
obfuscated2 Remove frame pool for obfuscated2 frames il y a 7 ans
proxy Fix small lint problem il y a 7 ans
scripts Add Makefile il y a 8 ans
stats Fix lint errors il y a 7 ans
telegram Fix lint errors il y a 7 ans
utils Fix lint errors il y a 7 ans
wrappers Add intermediate secure wrapper il y a 7 ans
.gitignore Correct list of supported platforms on cross compilation il y a 7 ans
.gometalinter.json Fix lint issues il y a 8 ans
.travis.yml Add travis yaml il y a 8 ans
Dockerfile Use upx for image build il y a 7 ans
Gopkg.lock Fix lint errors il y a 7 ans
Gopkg.toml Add base stats il y a 7 ans
LICENSE Initial commit il y a 8 ans
Makefile Correct list of supported platforms on cross compilation il y a 7 ans
README.md Update README il y a 7 ans
main.go Fix lint errors il y a 7 ans
run-mtg.sh Update README il y a 7 ans

README.md

mtg

Bullshit-free MTPROTO proxy for Telegram

Build Status Docker Build Status

Rationale

There are several available proxies for Telegram MTPROTO available. Here are the most notable:

Almost all of them follow the way how official proxy was build. This includes support of multiple secrets, support of promoted channels etc.

mtg is an implementation in golang which is intended to be:

  • Lightweight It has to consume as less resources as possible but not by losing maintainability.
  • Easily deployable I strongly believe that Telegram proxies should follow the way of ShadowSocks: promoted channels is a strange way of doing business I suppose. I think the only viable way is to have a proxy with minimum configuration which should work everywhere.
  • Single secret I think that multiple secrets solves no problems and just complexify software. I also believe that in case of throwout proxies, this feature is useless luxury.
  • Minimum docker image size Official image is less than 2.5 megabytes. Literally.
  • No management WebUI This is an implementation of simple lightweight proxy. I won’t do that.

This proxy supports 2 modes of work: direct connection to Telegram and promoted channel mode. If you do not need promoted channels, I would recommend you to go with direct mode: this is way more robust.

To run proxy in direct mode, all you need to do is just provide a secret. If you do not provide ADTag as a second parameter, promoted channels mode won’t be activated.

To get promoted channel, please contact @MTProxybot and provide generated adtag as a second parameter.

How to build

$ make

If you want to build for another platform:

$ make crosscompile

If you want to build Docker image (called mtg):

$ make docker

Docker image

$ docker pull nineseconds/mtg

Configuration

Basically, to run this tool you need to configure as less as possible.

First, you need to generate a secret:

$ openssl rand -hex 16

or

$ head -c 512 /dev/urandom | md5sum | cut -f 1 -d ' '

Secure mode

If you want to support new secure mode, please prepend dd to the secret. For example, secret cf18fa8ea0267057e2c61a5f7322a8e7 should be ddcf18fa8ea0267057e2c61a5f7322a8e7. But pay attention that some old clients won’t support this mode. If this is not your case, I would suggest to go with this mode.

Oneliners to generate such secrets:

$ echo dd$(openssl rand -hex 16)

or

$ echo dd$(head -c 512 /dev/urandom | md5sum | cut -f 1 -d ' ')

How to run the tool

Now run the tool:

$ mtg <secret>

How to run the tool with ADTag:

$ mtg <secret> <adtag>

This tool will listen on port 3128 by default with the given secret.

One-line runner

$ docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg $(openssl rand -hex 16)

or in secret mode:

$ docker run --name mtg --restart=unless-stopped -p 3128:3128 -p 3129:3129 -d nineseconds/mtg dd$(openssl rand -hex 16)

You will have this tool up and running on port 3128. Now curl localhost:3129 to get tg:// links or do docker logs mtg. Also, port 3129 will show you some statistics if you are interested in.

Also, you can use run-mtg.sh script