Sign inSign up

lordarrin/tg-ws-proxy

By lordarrin

•Updated 1 day ago

A Docker container with tg-ws-proxy from Flowseal, with some improvements for my own convenience.

Image
Networking
5

10K+

lordarrin/tg-ws-proxy repository overview

Source code: https://github.com/LordArrin/tg-ws-proxy-docker⁠

Docker image for personal use. All credits to original author https://github.com/Flowseal/tg-ws-proxy⁠

I just made a few improvements for my own comfort:

ArgsDefaultDescription
PROXY_PORT1443Proxy port
PROXY_HOST0.0.0.0Proxy host
PROXY_SECRETrandom32 hex characters secret for client authorization. (Command to generate: openssl rand -hex 16)
PROXY_DC_IPS2:149.154.167.220 4:149.154.167.220Target IP of Telegram's data centers
PROXY_BUF4096Buffer size in KB
PROXY_POOL_SIZE2The number of prepared connections for each DC
NO_CFPROXYfalseDisable Cloudflare proxying attempt. Read more here⁠
CFPROXY_DOMAINSpecify your domain for proxying through Cloudflare. Read more here⁠
CFPROXY_WORKER_DOMAINSpecify your CF worker⁠ for proxying through Cloudflare.
KEEPALIVEfalseEnable WS keepalive pings to prevent connections from closing when idle. Experimental option, disabled by default. Requires configuring CF worker⁠ for this to work.
SOCKS_ENABLEDfalseEnable the built-in SOCKS5 proxy with traffic tunneling through CF worker⁠.
SOCKS_PORT1080The port on which the SOCKS5 proxy listens.
SOCKS_HOST0.0.0.0The host on which the SOCKS5 proxy listens.
SOCKS_USER(Optional) The username for SOCKS5 authentication. If specified together with SOCKS_PASS, authentication becomes strictly required.
SOCKS_PASS(Optional) The password for SOCKS5 authentication.
SOCKS_CONNECT_TIMEOUT10Timeout for establishing a WebSocket connection with CF worker⁠ (in seconds).

Example config:

services:
  tg-ws-proxy:
    image: lordarrin/tg-ws-proxy:latest
    container_name: tg-ws-proxy
    restart: unless-stopped
    network_mode: host
    environment:
      - PROXY_HOST=192.168.1.1
      - PROXY_PORT=****1
      - PROXY_SECRET=
      - CFPROXY_WORKER_DOMAIN=rough-unit-*.*.workers.dev
      - KEEPALIVE=true
      - SOCKS_ENABLED=true
      - SOCKS_HOST=192.168.1.1
      - SOCKS_PORT=****2
      - SOCKS_USER=***
      - SOCKS_PASS=***
    security_opt:
      - no-new-privileges:true
    read_only: true
    tmpfs:
      - /tmp:noexec,nosuid,size=64m
      - /home/app/.cache:noexec,nosuid,size=32m
    deploy:
      resources:
        limits:
          memory: 384M
          cpus: '1'

To generate a secret you can use:

openssl rand -hex 16  

⁠Telegram Desktop Settings

  1. Telegram → Settings → Advanced Settings → Connection Type → Proxy
  2. Add a proxy:
  • Type: MTProto
  • Server: 192.168.1.1 (or your own)
  • Port: 1443 (or your own)
  • Secret: from settings or logs

Tag summary

Content type

Image

Digest

sha256:36233b2ce…

Size

29.4 MB

Last updated

1 day ago

docker pull lordarrin/tg-ws-proxy