HowTo - Running a Mtproto proxy

0. download and install

install go(lang)

wget https://go.dev/dl/go1.17.6.linux-amd64.tar.gz

tar -C /usr/local -xvf go1.17.6.linux-amd64.tar.gz

might need sudo ;)

export PATH=$PATH:/usr/local/go/bin

check go version

>> go version go1.17.6 linux/amd64


then lets download the source code of the mtproto implementation

git clone https://github.com/9seconds/mtg.git

cd mtg

make static

if u want to make it "global" to ur system:

sudo cp mtg /usr/local/bin


1. setting up mtproto proxy

generate mtproto secret

./mtg generate-secret [your_ip_or_domain]

>> 7vo-EdcHk0SNkj0tAa37xYzibmJ5dGNzLnh5eb


make configuration file

nvim mtg.toml

secret = "7vo-EdcHk0SNkj0tAa37xYzibmJ5dGNzLnh5eb"
bind-to = "0.0.0.0:1984"

this tells proxy to run in port 1984 with secret

copy it to /etc

sudo cp mtg.toml /etc/mtg.toml


creating proxy service

nvim /etc/systemd/system/mtg.service

might need sudo :P

[Unit]
Description=mtg

[Service]
ExecStart=/usr/local/bin/mtg run /etc/mtg.toml
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

then;

1
2
3
sudo systemctl daemon-reload
sudo systemctl enable mtg
sudo systemctl start mtg

get proxy information

mtg access /etc/mtg.toml

{
  "ipv4": {
    "ip": "x.y.z.a",
    "port": 1984,
    "tg_url": "tg://proxy?...",
    "tg_qrcode": "https://api.qrserver.com/v1/create-qr-code?data...",
    "tme_url": "https://t.me/proxy?...",
    "tme_qrcode": "https://api.qrserver.com/v1/create-qr-code?data..."
  },
  "secret": {
    "hex": "...",
    "base64": "..."
  }
}

help freedom

> send it to your friends, make a collaborative proxy; fight for your freedom of expression, fight for your freedom to fight back.

> use the 'tg_url' value above to share it

> 'tme_qrcode' is a qrcode image, create flyers and distribute it on the streets, bus stops, subway stations, etc


"men in their prime, if they have convictions, are tasked to act on them."

Edit Report
Pub: 29 Jan 2022 02:16 UTC
Views: 2095