Sign inSign up

mazy/mtgs

By mazy

Updated over 7 years ago
Archived

MTPROTO proxy for Telegram with per-user tokens and RestAPI for that

Image
0

374

mazy/mtgs repository overview

mtgs

Go Report Card Docker Build Status

Bullshit MTPROTO proxy for Telegram with per-user tokens and RestAPI for that. Useful in corporate purposes.

Using Consul as KV storage for users.

Deployment

Kubernetes

Project can be deployed into K8s cluster by Helm chart.

Chart and documentation available here

docker-compose

Example of docker-compose with Traefik as proxy for API:

version: '3'

networks:
  proxy:
    external: true

services:
  mtgs:
      image: mazy/mtgs:latest
      ports:
        - 3128:3128
      environment:
        MTGS_CONSUL_HOST: consul
      depends_on: 
        - consul
      labels:
        - "traefik.enable=true"
        - "traefik.frontend.rule=Host:example.com;PathPrefix:/mtgs"
        - "traefik.port=8080"
        - "traefik.docker.network=proxy"
  consul:
    image: bitnami/consul:latest
    volumes:
      - .data/consul:/bitnami

API Documentation

Please see API.md

Environment variables

Environment variableCorresponding flagsDefault valueDescription
MTGS_DEBUG-d, --debugfalseRun in debug mode. Usually, you need to run in this mode only if you develop this tool or its maintainer is asking you to provide logs with such verbosity.
MTGS_VERBOSE-v, --verbosefalseRun in verbose mode. This is way less chatty than debug mode.
MTGS_IP-b, --bind-ip127.0.0.1Which IP should we bind to. As usual, 0.0.0.0 means that we want to listen on all interfaces. Also, 4 zeroes will bind to both IPv4 and IPv6.
MTGS_PORT-P, --bind-port3128Which port should we bind to (listen on).
MTGS_IPV4-4, --public-ipv4AutodetectIPv4 address of this proxy. This is required if you NAT your proxy or run it in a docker container. In that case, you absolutely need to specify public IPv4 address of the proxy, otherwise either URLs will be broken or proxy could not access Telegram middle proxies.
MTGS_IPV4_PORT--public-ipv4-portValue of --bind-portWhich port should be public of IPv4 interface. This affects only generated links and should be changed only if you NAT your proxy or run it in a docker container.
MTGS_IPV6-6, --public-ipv6AutodetectIPv6 address of this proxy. This is required if you NAT your proxy or run it in a docker container. In that case, you absolutely need to specify public IPv6 address of the proxy, otherwise either URLs will be broken or proxy could not access Telegram middle proxies.
MTGS_IPV6_PORT--public-ipv6-portValue of --bind-portWhich port should be public of IPv6 interface. This affects only generated links and should be changed only if you NAT your proxy or run it in a docker container.
MTGS_BUFFER_WRITE-w, --write-buffer65536The size of TCP write buffer in bytes. Write buffer is the buffer for messages which are going from client to Telegram.
MTGS_BUFFER_READ-r, --read-buffer131072The size of TCP read buffer in bytes. Read buffer is the buffer for messages from Telegram to client.
MTGS_SECURE_ONLY-s, --secure-onlyfalseSupport only clients with secure mode (i.e only clients with dd-secrets).
MTGS_ANTIREPLAY_MAXSIZE--anti-replay-max-size128Max size of antireplay cache in megabytes.
MTGS_ANTIREPLAY_EVICTIONTIME--anti-replay-eviction-time168hEviction time for antireplay cache entries.
MTGS_API_PORT-p, --api-port8080Which port should be public for Rest API.
MTGS_API_PATH--api-path/mtgWhich basepath should be use for Rest API (It useful when API behind proxy).
MTGS_CONSUL_HOST--consul-host127.0.0.1Address of Consul.
MTGS_CONSUL_PORT--consul-port8050Port of Consul.
MTGS_API_TOKEN-t, --api-token``Which token use for API authorization. Should be provided in Authorization header. Auth disabled if this value is empty

Tag summary

Content type

Image

Digest

Size

10.1 MB

Last updated

over 7 years ago

docker pull mazy/mtgs