mirror of
https://github.com/alexbers/mtprotoproxy.git
synced 2026-03-16 16:03:51 +00:00
Compare commits
1 Commits
stable
...
prometheus
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fcc854e80 |
17
Dockerfile
17
Dockerfile
@@ -1,14 +1,15 @@
|
|||||||
FROM ubuntu:24.04
|
FROM alpine:3.6
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y python3 python3-uvloop python3-cryptography python3-socks libcap2-bin ca-certificates && rm -rf /var/lib/apt/lists/*
|
RUN adduser tgproxy -u 10000 -D
|
||||||
RUN setcap cap_net_bind_service=+ep /usr/bin/python3.12
|
|
||||||
|
|
||||||
RUN useradd tgproxy -u 10000
|
RUN apk add --no-cache python3 py3-cryptography ca-certificates libcap
|
||||||
|
|
||||||
|
COPY mtprotoproxy.py config.py /home/tgproxy/
|
||||||
|
|
||||||
|
RUN chown -R tgproxy:tgproxy /home/tgproxy
|
||||||
|
RUN setcap cap_net_bind_service=+ep /usr/bin/python3.6
|
||||||
|
|
||||||
USER tgproxy
|
USER tgproxy
|
||||||
|
|
||||||
WORKDIR /home/tgproxy/
|
WORKDIR /home/tgproxy/
|
||||||
|
CMD ["./mtprotoproxy.py"]
|
||||||
COPY --chown=tgproxy mtprotoproxy.py config.py /home/tgproxy/
|
|
||||||
|
|
||||||
CMD ["python3", "mtprotoproxy.py"]
|
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -1,34 +1,26 @@
|
|||||||
# Async MTProto Proxy #
|
# Async MTProto Proxy #
|
||||||
|
|
||||||
Fast and simple to setup MTProto proxy written in Python.
|
Fast and simple to setup mtproto proxy.
|
||||||
|
|
||||||
## Starting Up ##
|
## Starting Up ##
|
||||||
|
|
||||||
1. `git clone -b stable https://github.com/alexbers/mtprotoproxy.git; cd mtprotoproxy`
|
1. `git clone -b stable https://github.com/alexbers/mtprotoproxy.git; cd mtprotoproxy`
|
||||||
2. *(optional, recommended)* edit *config.py*, set **PORT**, **USERS** and **AD_TAG**
|
2. *(optional, recommended)* edit *config.py*, set **PORT**, **USERS** and **AD_TAG**
|
||||||
3. `docker-compose up -d` (or just `python3 mtprotoproxy.py` if you don't like Docker)
|
3. `docker-compose up --build -d` (or just `python3 mtprotoproxy.py` if you don't like docker)
|
||||||
4. *(optional, get a link to share the proxy)* `docker-compose logs`
|
4. *(optional, shows telegram link to set the proxy)* `docker-compose logs`
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Channel Advertising ##
|
## Channel Advertising ##
|
||||||
|
|
||||||
To advertise a channel get a tag from **@MTProxybot** and put it to *config.py*.
|
To advertise a channel get a tag from **@MTProxybot** and write it to *config.py*.
|
||||||
|
|
||||||
## Performance ##
|
## Performance ##
|
||||||
|
|
||||||
The proxy performance should be enough to comfortably serve about 4 000 simultaneous users on
|
The proxy performance should be enough to comfortably serve about 4 000 simultaneous users on
|
||||||
the VDS instance with 1 CPU core and 1024MB RAM.
|
the VDS instance with 1 CPU core and 1024MB RAM.
|
||||||
|
|
||||||
## More Instructions ##
|
|
||||||
|
|
||||||
- [Running without Docker](https://github.com/alexbers/mtprotoproxy/wiki/Running-Without-Docker)
|
|
||||||
- [Optimization and fine tuning](https://github.com/alexbers/mtprotoproxy/wiki/Optimization-and-Fine-Tuning)
|
|
||||||
|
|
||||||
## Advanced Usage ##
|
## Advanced Usage ##
|
||||||
|
|
||||||
The proxy can be launched:
|
The proxy can be launched:
|
||||||
- with a custom config: `python3 mtprotoproxy.py [configfile]`
|
- with a custom config: `python3 mtprotoproxy.py [configfile]`
|
||||||
- several times, clients will be automaticaly balanced between instances
|
- several times, clients will be automaticaly balanced between instances
|
||||||
- with uvloop module to get an extra speed boost
|
- using *PyPy* interprteter
|
||||||
- with runtime statistics exported to [Prometheus](https://prometheus.io/)
|
|
||||||
|
|||||||
23
config.py
23
config.py
@@ -1,27 +1,10 @@
|
|||||||
PORT = 443
|
PORT = 3256
|
||||||
|
|
||||||
# name -> secret (32 hex chars)
|
# name -> secret (32 hex chars)
|
||||||
USERS = {
|
USERS = {
|
||||||
"tg": "00000000000000000000000000000001",
|
"tg": "00000000000000000000000000000000",
|
||||||
# "tg2": "0123456789abcdef0123456789abcdef",
|
"tg2": "0123456789abcdef0123456789abcdef"
|
||||||
}
|
}
|
||||||
|
|
||||||
MODES = {
|
|
||||||
# Classic mode, easy to detect
|
|
||||||
"classic": False,
|
|
||||||
|
|
||||||
# Makes the proxy harder to detect
|
|
||||||
# Can be incompatible with very old clients
|
|
||||||
"secure": False,
|
|
||||||
|
|
||||||
# Makes the proxy even more hard to detect
|
|
||||||
# Can be incompatible with old clients
|
|
||||||
"tls": True
|
|
||||||
}
|
|
||||||
|
|
||||||
# The domain for TLS mode, bad clients are proxied there
|
|
||||||
# Use random existing domain, proxy checks it on start
|
|
||||||
# TLS_DOMAIN = "www.google.com"
|
|
||||||
|
|
||||||
# Tag for advertising, obtainable from @MTProxybot
|
# Tag for advertising, obtainable from @MTProxybot
|
||||||
# AD_TAG = "3c09c680b76ee91a4c25ad51f742267d"
|
# AD_TAG = "3c09c680b76ee91a4c25ad51f742267d"
|
||||||
|
|||||||
@@ -4,13 +4,4 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
volumes:
|
|
||||||
- ./config.py:/home/tgproxy/config.py
|
|
||||||
- ./mtprotoproxy.py:/home/tgproxy/mtprotoproxy.py
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
logging:
|
|
||||||
driver: "json-file"
|
|
||||||
options:
|
|
||||||
max-file: "10"
|
|
||||||
max-size: "10m"
|
|
||||||
# mem_limit: 1024m
|
# mem_limit: 1024m
|
||||||
|
|||||||
2107
mtprotoproxy.py
2107
mtprotoproxy.py
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user