baicai

白菜

一个勤奋的代码搬运工!

Docker builds MTProto protocol for internet access.

System Environment:
Debian-based (For other systems, simply replace apt with the corresponding package management tool name)

Installing Docker#

sudo apt update && sudo apt -y upgrade && sudo apt install -y docker docker.io docker-compose

Starting Docker#

sudo systemctl enable docker && sudo systemctl start docker

Verifying successful installation#

sudo docker run hello-world

Running mtg v2 version with Docker#

Generating a secret key#

sudo docker pull baicailin/mtg
sudo docker run --rm baicailin/mtg generate-secret --hex trade.aliexpress.com
# You will see a string starting with "ee", like:
eexxx44f3762c8a97d14f89df8c0174726164652e616c69657870726573732e636f6d

Writing a simple configuration#

echo "secret = \"Insert the generated key from the previous step\"" >config.toml
echo "bind-to = \"0.0.0.0:443\"" >>config.toml

Running the Docker image command#

sudo docker run -d -v $PWD/config.toml:/config.toml -p 443:443 --name baicai_mtg --restart=unless-stopped baicailin/mtg

Starting with docker-compose (alternative way to start)#

One-click start with docker-compose.yaml file reference

version: "3"
services:
  mtg_v2:
    image:  baicailin/mtg
    container_name: "mtg_v2"
    restart: unless-stopped
    command: run /config.toml
    volumes:
      - ./config.toml:/config.toml
    environment:
      TZ: Asia/Shanghai
    ports:
      - "443:443"

Generating MTProto protocol service configuration#

sudo docker exec mtg_v2 /mtg access /config.toml

Running mtg_v1 version (with adtag sponsorship option)#

Generating a secret key

$ docker run --rm baicailin/mtg:1 generate-secret tls -c bing.com
eedf71035a8ed48a623d8e83e66aec4d0562696e672e636f6d

Starting with docker-compose (alternative way to start)#

One-click start with docker-compose.yaml file reference:

version: "3"
services:
  mtg_v1:
    image:  baicailin/mtg:1
    container_name: "mtg_v1"
    restart: unless-stopped
    command: run eedf71035a8ed48a623d8e83e66aec4d0562696e672e636f6d adtag
    environment:
      TZ: Asia/Shanghai
    ports:
      - "1443:3128"
      - "1444:3129"

The adtag in the run command parameter can be obtained by creating a tg bot @MTProxybot.

Viewing MTProto protocol service configuration#

Run the following command in the directory of the mtg v1 docker-compose.yml file:

docker-compose logs
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.