banner
年糕

年糕日记

此站为备份站点,最新文章请访问 oior.net
telegram
email

Building MTP Proxy on ARM Framework

Many people don't know what to put on their Oracle ARM architecture servers that they have obtained for free. It is easy to fail when trying to set up an MTP proxy on these servers due to various errors. Today, I will provide a simple guide on how to set up MTProxy on ARM architecture.

MTProto Proxy (also known as MTProxy) is a proxy protocol developed by Telegram for communication connections. The project was originally developed in C language and only supported x86 architecture. Therefore, it cannot be compiled directly. Many people have submitted requests to adapt it to other architectures, but there has been no response from the official team.

The official repository has not been updated for 3 years, but the protocol itself is still usable. Since most servers sold by hosting providers are based on x86 architecture, most people can use it without any issues. Additionally, there is no significant need for updates as the protocol already supports FakeTLS.

To meet the needs of a small number of users, we have chosen a third-party developed MTProxy server. It is developed in Golang, making it easy to compile and deploy on different platforms, including ARM architecture.

Repository link: https://github.com/9seconds/mtg

Version Differences#

There are two versions: v1 and v2, with some minor differences. The differences in usage are not significant. The most important difference is that v1 supports adtag channel sharing, while v2 does not.

The author believes that MTP proxies are meant to be used in private and niche circles to ensure security and confidentiality. Publicly sharing and promoting them for profit through advertisements can easily be detected by network operators. These two purposes contradict each other. Therefore, adtag has been removed in the latest version. However, v1 will still be maintained for important issues.

One-Click Script#

Project link: https://github.com/ellermister/mtproxy

The latest one-click script supports ARM servers. The mtproxy one-click installation script will automatically compile and install 9seconds/mtg on ARM architecture servers.

mkdir /home/mtproxy && cd /home/mtproxy
curl -s -o mtproxy.sh https://raw.githubusercontent.com/ellermister/mtproxy/master/mtproxy.sh && chmod +x mtproxy.sh && bash mtproxy.sh

Docker Version#

If you haven't installed Docker, you can use the following script to install it:

sh get-docker.sh

Create an mtproxy proxy container using Docker:

docker run --name nginx-mtproxy -d  \
-p 80:80 -p 443:443 \
-e ip_white_list="OFF" \
ellermister/nginx-mtproxy:latest

The Docker image has more features, such as support for whitelists. For more information, see https://hub.docker.com/r/ellermister/nginx-mtproxy

Compilation and Installation#

If you want to compile and install it yourself, you can follow these steps. Here, we will use the v1 version of mtg. The process is similar for v2, with only differences in the running method.

Get the Source Code#

mkdir ~/work && cd ~/work
git clone https://github.com/9seconds/mtg.git -b v1 --depth=1

Install Golang#

Choose the appropriate Golang installation package for your system architecture: https://go.dev/dl/. Here, we will use arm64.

wget https://go.dev/dl/go1.18.4.linux-arm64.tar.gz
tar -xzf go1.18.4.linux-arm64.tar.gz -C /usr/local/
export PATH=$PATH:/usr/local/go/bin
rm -f go1.18.4.linux-arm64.tar.gz

Compile mtg#

The default Makefile script provided by the author compiles the static files for the current system. If you are compiling on an ARM architecture system, you don't need to make any changes. If you want to cross-compile, refer to CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build for compilation.

cd ~/work/mtg
make static

After successful compilation, you will have a static mtg file in the current directory. You can give it executable permissions and copy it to another location for use.

chmod +x mtg
cp mtg /usr/local/bin

Run mtg#

mtg run <secret> <adtag>

Parameter explanation:

  • secret is your MTProxy secret key, which consists of a 32-character random string and the domain used by your fakeTLS.
  • adtag is the key used for promotion channels, which can be obtained from the @MTProxybot.

Generate a secret with TLS obfuscation:

mtg generate-secret -c aws.amazon.com tls
ee5244d2387a0b6945bf96d0433ea3009b6177732e616d617a6f6e2e636f6d

Complete example:

mtg run ee5244d2387a0b6945bf96d0433ea3009b6177732e616d617a6f6e2e636f6d 7cfeefce74c922a85e2c6c3c8efb50e3 -b 0.0.0.0:443 >/dev/null 2>&1 &

If you want it to run on startup, you can add the above command to /etc/rc.local.

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