mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-08-09 23:43:34 +03:00
Добавить двуязычную документацию (русский и английский) (#1101)
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# Building from Source
|
||||
|
||||
## Console Proxy
|
||||
|
||||
To run only the proxy without the system tray interface, basic installation is sufficient:
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy
|
||||
```
|
||||
|
||||
## Tray Application by OS
|
||||
|
||||
### Windows 7/10+
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-win
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
Requires a Python build with Tk support. You can verify it with the command `python3 -m tkinter`.
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-macos
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-linux
|
||||
```
|
||||
|
||||
## Console Mode from Source
|
||||
|
||||
```bash
|
||||
tg-ws-proxy [--port PORT] [--host HOST] [--dc-ip DC:IP ...] [-v]
|
||||
```
|
||||
|
||||
**Arguments:**
|
||||
|
||||
| Argument | Default | Description |
|
||||
|---|---|---|
|
||||
| `--port` | `1443` | Proxy port |
|
||||
| `--host` | `127.0.0.1` | Proxy host |
|
||||
| `--secret` | `random` | 32-character hex key for client authorization |
|
||||
| `--dc-ip` | `2:149.154.167.220`, `4:149.154.167.220` | Target IP for DC (can be specified multiple times) |
|
||||
| `--no-cfproxy` | `false` | Disable [Cloudflare proxying](./CfProxy.md) attempts |
|
||||
| `--cfproxy-domain` | | Specify your own domain for Cloudflare proxying [Learn more](./CfProxy.md). Can be specified multiple times. |
|
||||
| `--cfproxy-worker-domain` | | Cloudflare Worker domain [Learn more](./CfWorker.md). Can be specified multiple times. |
|
||||
| `--fake-tls-domain` | | Enable Fake TLS masquerading (ee-secret) with specified SNI domain |
|
||||
| `--proxy-protocol` | disabled | Accept HAProxy PROXY protocol v1 (for use behind nginx/haproxy with `proxy_protocol on`) |
|
||||
| `--buf-kb` | `256` | Buffer size in KB |
|
||||
| `--pool-size` | `4` | Number of pre-allocated connections per DC |
|
||||
| `--log-file` | disabled | Path to file for saving logs |
|
||||
| `--log-max-mb` | `5` | Maximum log file size in MB (afterwards overwrites) |
|
||||
| `--log-backups` | `0` | Number of log backups after overwrite |
|
||||
| `-v`, `--verbose` | disabled | Verbose logging (DEBUG) |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```bash
|
||||
# Standard startup
|
||||
tg-ws-proxy
|
||||
|
||||
# Different port and additional DCs
|
||||
tg-ws-proxy --port 9050 --dc-ip 1:149.154.175.205 --dc-ip 2:149.154.167.220
|
||||
|
||||
# With verbose logging
|
||||
tg-ws-proxy -v
|
||||
|
||||
# Fake TLS masquerading (ee-secret)
|
||||
tg-ws-proxy --fake-tls-domain example.com
|
||||
```
|
||||
@@ -0,0 +1,48 @@
|
||||
# CONTRIBUTING
|
||||
|
||||
Thank you for wanting to help the `tg-ws-proxy` project.
|
||||
|
||||
## Before Creating an Issue
|
||||
|
||||
1. Check the documentation in `docs/README.md`.
|
||||
2. Make sure a similar issue hasn't already been opened.
|
||||
3. Use standard labels from `.github/labels.md` for correct triage.
|
||||
|
||||
## How to Report Problems
|
||||
|
||||
- Use the `Problem` template.
|
||||
- If possible, provide:
|
||||
- Application version,
|
||||
- Operating system,
|
||||
- Steps to reproduce,
|
||||
- Expected and actual behavior,
|
||||
- Log file or error text.
|
||||
|
||||
The more precise your description, the faster we can help.
|
||||
|
||||
## Local Development from Source
|
||||
|
||||
Python `>=3.8` is required.
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
Running:
|
||||
|
||||
- console mode: `tg-ws-proxy`
|
||||
- Windows tray: `tg-ws-proxy-tray-win`
|
||||
- macOS tray: `tg-ws-proxy-tray-macos`
|
||||
- Linux tray: `tg-ws-proxy-tray-linux`
|
||||
|
||||
Details: `docs/BuildFromSource.md`.
|
||||
|
||||
## Pull Request
|
||||
|
||||
Before opening a PR:
|
||||
|
||||
1. Make sure your change solves a specific problem.
|
||||
2. Check that existing scenarios aren't broken.
|
||||
3. Update documentation if behavior or configuration changes.
|
||||
|
||||
Smaller and focused PRs are reviewed and accepted faster.
|
||||
@@ -0,0 +1,32 @@
|
||||
# Cloudflare Proxy
|
||||
|
||||
An alternative, free connection method is proxying through Cloudflare, which can be used for unreachable data centers. **All you need to get it working is a domain**. The application includes a default domain, but it can (and ideally should) be replaced with your own.
|
||||
|
||||
The proxy restores access to content that previously wouldn't load (reactions, certain stickers). If you are using a non-Premium account and photos/videos still fail to load, leave only `4:149.154.167.220` in the `DC → IP` block. If the CF proxy works, media will start loading again.
|
||||
|
||||
## Why should I set up my own domain?
|
||||
|
||||
Cloudflare limits the number of simultaneous WebSocket (WS) connections. The default domain could stop working at any moment.
|
||||
|
||||
## Setting up your own domain
|
||||
|
||||
1. Add your domain to Cloudflare (either by purchasing it directly from Cloudflare or by changing the NS servers: https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/). Domains cost around $1.50–$2.00 per year, and any domain extension will work.
|
||||
|
||||
2. In `SSL/TLS` → `Overview`, set the mode to **Flexible**.
|
||||
|
||||
3. In `DNS` → `Records`, add the following `A` records via `+ Add Record`:
|
||||
- Name=`kws1` IPv4=`149.154.175.50`
|
||||
- Name=`kws2` IPv4=`149.154.167.51`
|
||||
- Name=`kws3` IPv4=`149.154.175.100`
|
||||
- Name=`kws4` IPv4=`149.154.167.91`
|
||||
- Name=`kws5` IPv4=`149.154.171.5`
|
||||
- Name=`kws203` IPv4=`91.105.192.100`
|
||||
|
||||
4. **Add your domain to [zapret](https://github.com/Flowseal/zapret-discord-youtube/) or any other DPI bypass software, as the Cloudflare subnet may be blocked (e.g., in Russia).**
|
||||
|
||||
5. In the `TgWsProxy` settings, replace the default domain with your own.
|
||||
|
||||
## Credits / Acknowledgments
|
||||
|
||||
- Original Idea: https://github.com/Nekogram/WSProxy
|
||||
- Special thanks to [@UjuiUjuMandan](https://github.com/UjuiUjuMandan) for providing the information.
|
||||
@@ -0,0 +1,129 @@
|
||||
# Cloudflare Worker
|
||||
|
||||
An alternative (completely free, no domain purchase required unlike [CfProxy](./CfProxy.md)) method for proxying.
|
||||
|
||||
The proxy restores access to content that previously wouldn't load (reactions, certain stickers). If you are using a non-Premium account with this method and photos/videos still fail to load, leave only `4:149.154.167.220` in the `DC → IP` block.
|
||||
|
||||
##
|
||||
|
||||
1. **Add the following domains to [zapret](https://github.com/Flowseal/zapret-discord-youtube/) or any other DPI bypass software:**
|
||||
|
||||
```
|
||||
cloudflare.com
|
||||
cloudflare.dev
|
||||
workers.dev
|
||||
```
|
||||
|
||||
2. Create an account on [Cloudflare](https://dash.cloudflare.com/) (or log into an existing one)
|
||||
* **After creating your account, verify your email using the link sent to your inbox**
|
||||
3. Select `Compute` → `Workers & Pages` from the left panel
|
||||
<img width="250" height="768" alt="image" src="https://github.com/user-attachments/assets/d81e3522-045a-4e65-9c2e-5545b7ad409a" />
|
||||
|
||||
4. Click the **`Create application`** button in the top right → `Start with Hello World!` → `Deploy`
|
||||
<img width="1406" height="193" alt="image" src="https://github.com/user-attachments/assets/7ac65944-8761-42a6-ab6d-ba5f9080c883" />
|
||||
<img width="586" height="379" alt="image" src="https://github.com/user-attachments/assets/ff901439-c2a1-4867-95de-e11b82a37044" />
|
||||
<img width="624" height="694" alt="image" src="https://github.com/user-attachments/assets/bb68d49a-166d-42a0-8fe2-bd2b16c0d066" />
|
||||
|
||||
5. Click the **`Edit code`** button in the top right, then replace the code on the left with the one [found at the bottom of this page](#worker-code)
|
||||
* If the code section fails to load, it means you missed the first step
|
||||
<img width="911" height="117" alt="image" src="https://github.com/user-attachments/assets/6bcdf839-d776-47e9-9d18-ba0efdf53244" />
|
||||
<img width="1027" height="512" alt="image" src="https://github.com/user-attachments/assets/daf131ed-82d5-40f0-a7eb-daeb598bea40" />
|
||||
|
||||
|
||||
6. Click the **`Deploy`** button in the top right
|
||||
<img width="415" height="138" alt="image" src="https://github.com/user-attachments/assets/58d8f83e-d8b5-40cf-a30f-741d7311047b" />
|
||||
|
||||
7. Copy the domain from the field on the right and specify it in your **Cloudflare Worker** settings (or via the `--cfproxy-worker-domain` argument)
|
||||
* Example domain: `random-symbols-1234.username.workers.dev`
|
||||
* **You can specify multiple domains separated by commas (or by repeating the `--cfproxy-worker-domain` argument)**
|
||||
<img width="414" height="182" alt="image" src="https://github.com/user-attachments/assets/4fb0b111-8026-4d17-b993-6c70ec37f1f5" />
|
||||
|
||||
|
||||
|
||||
### Worker Code
|
||||
|
||||
```javascript
|
||||
import { connect } from "cloudflare:sockets";
|
||||
|
||||
function toBytes(data) {
|
||||
if (data instanceof ArrayBuffer) {
|
||||
return new Uint8Array(data);
|
||||
}
|
||||
if (typeof data === "string") {
|
||||
return new TextEncoder().encode(data);
|
||||
}
|
||||
if (data && typeof data.arrayBuffer === "function") {
|
||||
return data.arrayBuffer().then((ab) => new Uint8Array(ab));
|
||||
}
|
||||
return new Uint8Array();
|
||||
}
|
||||
|
||||
export default {
|
||||
async fetch(request) {
|
||||
if ((request.headers.get("Upgrade") || "").toLowerCase() !== "websocket") {
|
||||
return new Response("Expected websocket", { status: 426 });
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname !== "/apiws") {
|
||||
return new Response("Not found", { status: 404 });
|
||||
}
|
||||
|
||||
const dst = url.searchParams.get("dst");
|
||||
const pair = new WebSocketPair();
|
||||
const client = pair[0];
|
||||
const server = pair[1];
|
||||
server.accept();
|
||||
|
||||
const socket = connect({ hostname: dst, port: 443 });
|
||||
const tcpReader = socket.readable.getReader();
|
||||
const tcpWriter = socket.writable.getWriter();
|
||||
|
||||
server.addEventListener("message", async (event) => {
|
||||
try {
|
||||
await tcpWriter.write(await toBytes(event.data));
|
||||
} catch {
|
||||
try {
|
||||
server.close(1011, "tcp write failed");
|
||||
} catch {}
|
||||
}
|
||||
});
|
||||
|
||||
server.addEventListener("close", async () => {
|
||||
try {
|
||||
await tcpWriter.close();
|
||||
} catch {}
|
||||
try {
|
||||
socket.close();
|
||||
} catch {}
|
||||
});
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
while (true) {
|
||||
const { value, done } = await tcpReader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
if (value) {
|
||||
server.send(value);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
} finally {
|
||||
try {
|
||||
server.close();
|
||||
} catch {}
|
||||
try {
|
||||
tcpReader.releaseLock();
|
||||
} catch {}
|
||||
try {
|
||||
socket.close();
|
||||
} catch {}
|
||||
}
|
||||
})();
|
||||
|
||||
return new Response(null, { status: 101, webSocket: client });
|
||||
},
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,52 @@
|
||||
# Fake TLS + Upstream in Nginx
|
||||
|
||||
The domain in the `--fake-tls-domain` parameter should point to the same IP where the proxy is running.
|
||||
|
||||
## Example `nginx.conf` for Stream Module
|
||||
|
||||
```nginx
|
||||
upstream mtproto {
|
||||
server 127.0.0.1:8446;
|
||||
}
|
||||
|
||||
map $ssl_preread_server_name $sni_name {
|
||||
hostnames;
|
||||
example.com mtproto;
|
||||
# if you have xray with selfsni running:
|
||||
# sub.example.com www;
|
||||
# default xray;
|
||||
}
|
||||
|
||||
# upstream xray {
|
||||
# server 127.0.0.1:8443;
|
||||
# }
|
||||
#
|
||||
# upstream www {
|
||||
# server 127.0.0.1:7443;
|
||||
# }
|
||||
|
||||
server {
|
||||
proxy_protocol on;
|
||||
set_real_ip_from unix:;
|
||||
listen 443;
|
||||
proxy_pass $sni_name;
|
||||
ssl_preread on;
|
||||
}
|
||||
```
|
||||
|
||||
## Running Proxy Behind Nginx
|
||||
|
||||
```bash
|
||||
python3 proxy/tg_ws_proxy.py \
|
||||
--port 8446 \
|
||||
--host 127.0.0.1 \
|
||||
--fake-tls-domain example.com \
|
||||
--proxy-protocol \
|
||||
--secret <32-hex-chars>
|
||||
```
|
||||
|
||||
The connection link will be in `ee`-secret format:
|
||||
|
||||
```text
|
||||
tg://proxy?server=your.domain.com&port=443&secret=ee<secret><domain_hex>
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
> [!TIP]
|
||||
>
|
||||
> ### 🎉 Support Me
|
||||
>
|
||||
> **USDT (TRC20)**: `TXPnKs2Ww1RD8JN6nChFUVmi5r2hqrWjuu`
|
||||
> **BTC**: `bc1qr8vd6jelkyyry3m4mq6z5txdx4pl856fu6ss0w`
|
||||
> **ETH**: `0x1417878fdc5047E670a77748B34819b9A49C72F1`
|
||||
> **Other coins**: https://nowpayments.io/donation/flowseal
|
||||
|
||||
The project is completely free for everyone.
|
||||
However, its development and stable operation as the user base grows require investment.
|
||||
I would appreciate any form of support! Thank you ❤️
|
||||
@@ -0,0 +1,70 @@
|
||||
# TG WS Proxy for Docker
|
||||
|
||||
## Installation from Source
|
||||
|
||||
Enter the commands sequentially, one by one:
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/Flowseal/tg-ws-proxy.git
|
||||
|
||||
# Navigate to the project folder
|
||||
cd tg-ws-proxy
|
||||
|
||||
# Build the image
|
||||
docker build -t tg-ws-proxy .
|
||||
|
||||
# Run the container
|
||||
docker run -d \
|
||||
--name tg-ws-proxy \
|
||||
--restart=always \
|
||||
-p 1443:1443 \
|
||||
tg-ws-proxy:latest
|
||||
|
||||
# Get the connection link
|
||||
docker logs tg-ws-proxy 2>&1 | grep 'tg://proxy'
|
||||
```
|
||||
|
||||
After running the last command, you will see a link like:
|
||||
|
||||
```text
|
||||
tg://proxy?server=172.17.0.2&port=1443&secret=dd68f127db1d...
|
||||
```
|
||||
|
||||
## Configuring Parameters
|
||||
|
||||
All settings are configured using environment variables when running the container:
|
||||
|
||||
| Variable | Description | Default |
|
||||
| ----------------------- | -------------------------------- | --------------------------------- |
|
||||
| `TG_WS_PROXY_HOST` | Address for incoming connections | `0.0.0.0` |
|
||||
| `TG_WS_PROXY_PORT` | Port inside the container | `1443` |
|
||||
| `TG_WS_PROXY_SECRET` | Secret key | `random` |
|
||||
| `TG_WS_PROXY_DC_IPS` | DC number:IP pairs separated by space | `2:149.154.167.220 4:149.154.167.220` |
|
||||
| `TG_WS_PROXY_CF_WORKER` | Cloudflare Worker domain | `None` |
|
||||
|
||||
Example with manually specified secret:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name tg-ws-proxy \
|
||||
--restart=always \
|
||||
-p 1443:1443 \
|
||||
-e TG_WS_PROXY_SECRET="your_secret" \
|
||||
tg-ws-proxy:latest
|
||||
```
|
||||
|
||||
To generate a secret, you can use:
|
||||
|
||||
```bash
|
||||
openssl rand -hex 16
|
||||
```
|
||||
|
||||
## Configuring Telegram Desktop
|
||||
|
||||
1. Telegram → **Settings** → **Advanced** → **Connection type** → **Proxy**
|
||||
2. Add proxy:
|
||||
- **Type:** MTProto
|
||||
- **Server:** `127.0.0.1` (or your custom address)
|
||||
- **Port:** `1443` (or your custom port)
|
||||
- **Secret:** from settings or logs
|
||||
@@ -0,0 +1,51 @@
|
||||
# TG WS Proxy for Linux
|
||||
|
||||
## Prebuilt Packages
|
||||
|
||||
For Debian/Ubuntu, download the `TgWsProxy_linux_amd64.deb` package from the [releases page](https://github.com/Flowseal/tg-ws-proxy/releases).
|
||||
|
||||
For Arch and Arch-based distributions, packages are available in AUR:
|
||||
|
||||
- [tg-ws-proxy-bin](https://aur.archlinux.org/packages/tg-ws-proxy-bin)
|
||||
- [tg-ws-proxy-git](https://aur.archlinux.org/packages/tg-ws-proxy-git)
|
||||
- [tg-ws-proxy-cli](https://aur.archlinux.org/packages/tg-ws-proxy-cli)
|
||||
|
||||
```shell
|
||||
# Installation without AUR helper
|
||||
git clone https://aur.archlinux.org/tg-ws-proxy-bin.git
|
||||
cd tg-ws-proxy-bin
|
||||
makepkg -si
|
||||
|
||||
# Using AUR helper
|
||||
paru -S tg-ws-proxy-bin
|
||||
|
||||
# For -cli package, run via systemd (8888 — port number; secret can be generated with openssl rand -hex 16)
|
||||
sudo systemctl start tg-ws-proxy@8888:3075abe65830f0325116bb0416cadf9f
|
||||
```
|
||||
|
||||
For other distributions, you can use `TgWsProxy_linux_amd64` (binary for x86_64).
|
||||
|
||||
```bash
|
||||
chmod +x TgWsProxy_linux_amd64
|
||||
./TgWsProxy_linux_amd64
|
||||
```
|
||||
|
||||
On first launch, a window will open with instructions. The application runs in the system tray (AppIndicator required).
|
||||
|
||||
## Configuring Telegram Desktop
|
||||
|
||||
1. Telegram → **Settings** → **Advanced** → **Connection type** → **Proxy**
|
||||
2. Add proxy:
|
||||
- **Type:** MTProto
|
||||
- **Server:** `127.0.0.1` (or your custom address)
|
||||
- **Port:** `1443` (or your custom port)
|
||||
- **Secret:** from settings or logs
|
||||
|
||||
## Building from Source
|
||||
|
||||
Detailed instructions: [BuildFromSource.md](./BuildFromSource.md)
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-linux
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# TG WS Proxy for macOS
|
||||
|
||||
Go to the [releases page](https://github.com/Flowseal/tg-ws-proxy/releases) and download `TgWsProxy_macos_universal.dmg` (universal build for Apple Silicon and Intel).
|
||||
|
||||
1. Open the image
|
||||
2. Drag `TG WS Proxy.app` to the `Applications` folder
|
||||
3. On first launch, macOS may ask for confirmation: **System Settings → Privacy & Security → Open Anyway**
|
||||
|
||||
Minimum supported versions:
|
||||
|
||||
- Intel macOS 10.15+
|
||||
- Apple Silicon macOS 11.0+
|
||||
|
||||
## Configuring Telegram Desktop
|
||||
|
||||
1. Telegram → **Settings** → **Advanced** → **Connection type** → **Proxy**
|
||||
2. Add proxy:
|
||||
- **Type:** MTProto
|
||||
- **Server:** `127.0.0.1` (or your custom address)
|
||||
- **Port:** `1443` (or your custom port)
|
||||
- **Secret:** from settings or logs
|
||||
|
||||
## Building from Source
|
||||
|
||||
Detailed instructions: [BuildFromSource.md](./BuildFromSource.md)
|
||||
|
||||
The interface requires Tk, CustomTkinter, and access to Cocoa via PyObjC. They are installed automatically, except for Tk, which must be included in your Python build.
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-macos
|
||||
```
|
||||
@@ -0,0 +1,145 @@
|
||||
<div align="center">
|
||||
|
||||
**[🇷🇺 Русский](../README.md) • 🇬🇧 English**
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<img width="1729" height="910" alt="tgwsproxy" src="../images/workflow.png" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
##
|
||||
|
||||
> [!TIP]
|
||||
>
|
||||
> ### [🎉 Support Me](../EN/Funding.md)
|
||||
>
|
||||
> **USDT (TRC20)**: `TXPnKs2Ww1RD8JN6nChFUVmi5r2hqrWjuu`
|
||||
> **BTC**: `bc1qr8vd6jelkyyry3m4mq6z5txdx4pl856fu6ss0w`
|
||||
> **ETH**: `0x1417878fdc5047E670a77748B34819b9A49C72F1`
|
||||
> **Other coins**: https://nowpayments.io/donation/flowseal
|
||||
|
||||
> [!CAUTION]
|
||||
>
|
||||
> ### Antivirus Detection
|
||||
>
|
||||
> Antivirus software sometimes incorrectly marks the application as a virus due to the packer.
|
||||
> If you cannot download due to antivirus blocking, then:
|
||||
>
|
||||
> 1) **Try downloading the Windows 7 version (functionally identical)**
|
||||
> 2) Temporarily disable antivirus during download, add the file to exclusions, then re-enable
|
||||
>
|
||||
> Always verify what you download from the internet, especially from untrusted sources. It's best to check detections from well-known antivirus vendors on VirusTotal.
|
||||
|
||||
# TG WS Proxy
|
||||
|
||||
**Local MTProto proxy** for Telegram Desktop that **speeds up Telegram**, redirecting traffic through WebSocket connections. Data is transmitted in the same encrypted form, and no external servers are needed.
|
||||
|
||||
<picture>
|
||||
<source srcset="../images/preview-dark.png" media="(prefers-color-scheme: dark)">
|
||||
<img src="../images/preview-white.png">
|
||||
</picture>
|
||||
|
||||
## Navigation
|
||||
|
||||
- **🚀 Quick Start**
|
||||
- **[Windows](./README.windows.md)**
|
||||
- **[macOS](./README.macos.md)**
|
||||
- **[Linux](./README.linux.md)**
|
||||
- **[Docker](./README.docker.md)**
|
||||
- [Cloudflare Worker Setup (free alternative to CF proxy)](./CfWorker.md)
|
||||
- [Cloudflare Domain Setup (CF proxy)](./CfProxy.md)
|
||||
- [Telegram Test Environment (Test DCs)](./TestDc.md)
|
||||
- [Fake TLS + upstream in Nginx](./FakeTlsNginx.md)
|
||||
- [Tray Application Configuration Files](./TrayConfig.md)
|
||||
- [Building from Source](./BuildFromSource.md)
|
||||
- [Contributor Guide](./CONTRIBUTING.md)
|
||||
|
||||
## Windows: Quick Start
|
||||
|
||||
Go to the [releases page](https://github.com/Flowseal/tg-ws-proxy/releases) and download:
|
||||
|
||||
- `TgWsProxy_windows.exe` (Windows 10+ x64)
|
||||
- `TgWsProxy_windows_arm64.exe` (Windows 10+ ARM64)
|
||||
- `TgWsProxy_windows_7_64bit.exe` (Windows 7 x64)
|
||||
- `TgWsProxy_windows_7_32bit.exe` (Windows 7 x32)
|
||||
|
||||
On first launch, a window will open with instructions for connecting Telegram Desktop. **The application minimizes to system tray.**
|
||||
|
||||
### Tray Menu
|
||||
|
||||
- **Open in Telegram** — automatically configure proxy via `tg://proxy` link
|
||||
- **Copy Link** — copy the proxy connection link
|
||||
- **Restart Proxy** — restart without exiting the application
|
||||
- **Settings...** — GUI configuration editor (app version, optional GitHub update checks)
|
||||
- **Open Logs** — open log file
|
||||
- **Exit** — stop proxy and close application
|
||||
|
||||
### Configuring Telegram Desktop
|
||||
|
||||
**Automatic Setup**
|
||||
|
||||
Right-click the tray icon and select **"Open in Telegram"**.
|
||||
|
||||
If it doesn't work (Telegram doesn't open with proxy), follow these steps:
|
||||
|
||||
1. Right-click the tray icon and select **"Copy Link"**
|
||||
2. Send the link to "Saved Messages" in Telegram and click it
|
||||
3. Connect
|
||||
|
||||
**Manual Setup**
|
||||
|
||||
1. Telegram → **Settings** → **Advanced** → **Connection type** → **Proxy**
|
||||
2. Add proxy:
|
||||
- **Type:** MTProto
|
||||
- **Server:** `127.0.0.1` (or your custom address)
|
||||
- **Port:** `1443` (or your custom port)
|
||||
- **Secret:** from settings or logs
|
||||
|
||||
## How It Works
|
||||
|
||||
```
|
||||
Telegram Desktop → MTProto Proxy (127.0.0.1:1443) → WebSocket → Telegram DC
|
||||
```
|
||||
|
||||
1. Application starts MTProto proxy on `127.0.0.1:1443`
|
||||
2. Intercepts connections to Telegram IP addresses
|
||||
3. Extracts DC ID from MTProto obfuscation init packet
|
||||
4. Establishes WebSocket connection (TLS) to corresponding DC via Telegram domains
|
||||
5. If WS unavailable (302 redirect) — automatically switches to CfProxy / direct TCP connection
|
||||
|
||||
> [!IMPORTANT]
|
||||
> ### Photos/Videos Not Loading?
|
||||
> **In proxy settings, leave only `4:149.154.167.220` in DC → IP**
|
||||
> **If that doesn't work, clear the field completely**
|
||||
> This issue occurs on non-Premium accounts
|
||||
> If still not working, set up your own domain following: [CfProxy.md](./CfProxy.md)
|
||||
|
||||
## Automatic Build
|
||||
|
||||
The project contains PyInstaller specs ([`packaging/windows.spec`](../../packaging/windows.spec), [`packaging/macos.spec`](../../packaging/macos.spec), [`packaging/linux.spec`](../../packaging/linux.spec)) and GitHub Actions workflow ([`.github/workflows/build.yml`](../../.github/workflows/build.yml)) for automated builds.
|
||||
|
||||
Minimum supported OS versions for current binary builds:
|
||||
|
||||
- Windows 10+ x64 for `TgWsProxy_windows.exe`
|
||||
- Windows 10+ ARM64 for `TgWsProxy_windows_arm64.exe`
|
||||
- Windows 7 (x64) for `TgWsProxy_windows_7_64bit.exe`
|
||||
- Windows 7 (x32) for `TgWsProxy_windows_7_32bit.exe`
|
||||
- Intel macOS 10.15+
|
||||
- Apple Silicon macOS 11.0+
|
||||
- Linux x86_64 (AppIndicator required for system tray)
|
||||
|
||||
## Contributors
|
||||
|
||||
Thanks to everyone who helps develop this project ❤️
|
||||
|
||||
<a href="https://github.com/Flowseal/tg-ws-proxy/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Flowseal/tg-ws-proxy" />
|
||||
</a>
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](../../LICENSE)
|
||||
@@ -0,0 +1,58 @@
|
||||
# TG WS Proxy for Windows
|
||||
|
||||
Go to the [releases page](https://github.com/Flowseal/tg-ws-proxy/releases) and download:
|
||||
|
||||
- `TgWsProxy_windows.exe` (Windows 10+ x64)
|
||||
- `TgWsProxy_windows_arm64.exe` (Windows 10+ ARM64)
|
||||
- `TgWsProxy_windows_7_64bit.exe` (Windows 7 x64)
|
||||
- `TgWsProxy_windows_7_32bit.exe` (Windows 7 x32)
|
||||
|
||||
Builds are published automatically via [GitHub Actions](https://github.com/Flowseal/tg-ws-proxy/actions) from open source code.
|
||||
|
||||
On first launch, a window will open with instructions for connecting Telegram Desktop. **The application minimizes to system tray.**
|
||||
|
||||
## Tray Menu
|
||||
|
||||
- **Open in Telegram** — automatically configure proxy via `tg://proxy` link
|
||||
- **Copy Link** — copy the proxy connection link
|
||||
- **Restart Proxy** — restart without exiting the application
|
||||
- **Settings...** — GUI configuration editor (app version, optional GitHub update checks)
|
||||
- **Open Logs** — open log file
|
||||
- **Exit** — stop proxy and close application
|
||||
|
||||
On first launch after startup, you may be prompted to open the release page if a new version is available on GitHub (this check can be disabled in settings).
|
||||
|
||||
## Configuring Telegram Desktop
|
||||
|
||||
### Automatic Setup
|
||||
|
||||
Right-click the tray icon and select **"Open in Telegram"**.
|
||||
|
||||
If it doesn't work (Telegram doesn't open with proxy), follow these steps:
|
||||
|
||||
1. Right-click the tray icon and select **"Copy Link"**
|
||||
2. Send the link to "Saved Messages" in Telegram and click it
|
||||
3. Connect
|
||||
|
||||
### Manual Setup
|
||||
|
||||
1. Telegram → **Settings** → **Advanced** → **Connection type** → **Proxy**
|
||||
2. Add proxy:
|
||||
- **Type:** MTProto
|
||||
- **Server:** `127.0.0.1` (or your custom address)
|
||||
- **Port:** `1443` (or your custom port)
|
||||
- **Secret:** from settings or logs
|
||||
|
||||
## Portable Mode
|
||||
|
||||
Portable mode is automatically enabled if a folder named `TgWsProxy_data` exists next to the executable.
|
||||
You can also force portable mode by running the executable with the `--portable` parameter (it will create the folder).
|
||||
|
||||
## Building from Source
|
||||
|
||||
Detailed instructions: [BuildFromSource.md](./BuildFromSource.md)
|
||||
|
||||
```bash
|
||||
pip install -e .
|
||||
tg-ws-proxy-tray-win
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
# Telegram Test Environment (Test DCs)
|
||||
|
||||
Traffic routing to Telegram test data centers (test environment).
|
||||
Useful for developing/testing bots and clients within the Telegram test environment.
|
||||
|
||||
## How to Enable
|
||||
|
||||
**Automatically.** Telegram Desktop marks test DCs with a +10000
|
||||
offset (10001–10003). The proxy automatically detects this offset — no configuration needed, allowing
|
||||
you to use production and test accounts simultaneously in a single client.
|
||||
|
||||
**Forced.** For clients that report test DCs as standard 1-3
|
||||
(Telethon, TDLib) — they cannot be detected automatically. In this case, all traffic
|
||||
is forcibly routed to test DCs (production accounts will stop working through this proxy).
|
||||
To force this behavior, use the `--force-test-dc` flag in CLI:
|
||||
|
||||
```bash
|
||||
tg-ws-proxy --force-test-dc # + your --secret / --port
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
Only works for **direct DC → IP** and **Cloudflare Worker** routes (see [Setting up a Cloudflare Worker](./CfWorker.md)).
|
||||
@@ -0,0 +1,32 @@
|
||||
# Tray Application Configuration Files
|
||||
|
||||
The tray application stores data in:
|
||||
|
||||
- **Windows:** `%APPDATA%/TgWsProxy`
|
||||
- **macOS:** `~/Library/Application Support/TgWsProxy`
|
||||
- **Linux:** `~/.config/TgWsProxy` (or `$XDG_CONFIG_HOME/TgWsProxy`)
|
||||
|
||||
```json
|
||||
{
|
||||
"host": "127.0.0.1",
|
||||
"port": 1443,
|
||||
"secret": "...",
|
||||
"dc_ip": [
|
||||
"2:149.154.167.220",
|
||||
"4:149.154.167.220"
|
||||
],
|
||||
"verbose": false,
|
||||
"buf_kb": 256,
|
||||
"pool_size": 4,
|
||||
"log_max_mb": 5.0,
|
||||
"check_updates": true,
|
||||
"cfproxy": true,
|
||||
"cfproxy_user_domain": "",
|
||||
"cfproxy_worker_domain": "",
|
||||
"force_test_dc": false,
|
||||
"appearance": "auto"
|
||||
}
|
||||
```
|
||||
|
||||
The `check_updates` key: when `true`, performs a request to GitHub and compares the current version with the latest release (notification and link to download page only).
|
||||
On Windows, the config may contain `autostart` (auto-start on system login).
|
||||
+19
-13
@@ -1,3 +1,9 @@
|
||||
<div align="center">
|
||||
|
||||
**🇷🇺 Русский • [🇬🇧 English](./EN/README.md)**
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
@@ -9,7 +15,7 @@
|
||||
|
||||
> [!TIP]
|
||||
>
|
||||
> ### [🎉 Поддержать меня](./Funding.md)
|
||||
> ### [🎉 Поддержать меня](./RU/Funding.md)
|
||||
>
|
||||
> **USDT (TRC20)**: `TXPnKs2Ww1RD8JN6nChFUVmi5r2hqrWjuu`
|
||||
> **BTC**: `bc1qr8vd6jelkyyry3m4mq6z5txdx4pl856fu6ss0w`
|
||||
@@ -40,17 +46,17 @@
|
||||
## Навигация
|
||||
|
||||
- **🚀 Быстрый старт**
|
||||
- **[Windows](./README.windows.md)**
|
||||
- **[macOS](./README.macos.md)**
|
||||
- **[Linux](./README.linux.md)**
|
||||
- **[Docker](./README.docker.md)**
|
||||
- [Настройка Cloudflare Worker'а (бесплатный аналог CF-прокси)](./CfWorker.md)
|
||||
- [Настройка Cloudflare-домена (CF-прокси)](./CfProxy.md)
|
||||
- [Тестовое окружение Telegram (тестовые DC)](./TestDc.md)
|
||||
- [Fake TLS + upstream в Nginx](./FakeTlsNginx.md)
|
||||
- [Файлы конфигурации Tray-приложения](./TrayConfig.md)
|
||||
- [Установка из исходников](./BuildFromSource.md)
|
||||
- [Руководство для контрибьюторов](./CONTRIBUTING.md)
|
||||
- **[Windows](./RU/README.windows.md)**
|
||||
- **[macOS](./RU/README.macos.md)**
|
||||
- **[Linux](./RU/README.linux.md)**
|
||||
- **[Docker](./RU/README.docker.md)**
|
||||
- [Настройка Cloudflare Worker'а (бесплатный аналог CF-прокси)](./RU/CfWorker.md)
|
||||
- [Настройка Cloudflare-домена (CF-прокси)](./RU/CfProxy.md)
|
||||
- [Тестовое окружение Telegram (тестовые DC)](./RU/TestDc.md)
|
||||
- [Fake TLS + upstream в Nginx](./RU/FakeTlsNginx.md)
|
||||
- [Файлы конфигурации Tray-приложения](./RU/TrayConfig.md)
|
||||
- [Установка из исходников](./RU/BuildFromSource.md)
|
||||
- [Руководство для контрибьюторов](./RU/CONTRIBUTING.md)
|
||||
|
||||
## Windows: быстрый вход
|
||||
|
||||
@@ -110,7 +116,7 @@ Telegram Desktop → MTProto Proxy (127.0.0.1:1443) → WebSocket → Telegram D
|
||||
> **Удалите в настройках прокси в DC → IP всё, кроме `4:149.154.167.220`**
|
||||
> **Если это не помогло, полностью очистите это поле**
|
||||
> Подобная проблема встречается на аккаунтах без Premium
|
||||
> Если это не помогло, настройте собственный домен по инструкции: [CfProxy.md](./CfProxy.md)
|
||||
> Если это не помогло, настройте собственный домен по инструкции: [CfProxy.md](./RU/CfProxy.md)
|
||||
|
||||
## Автоматическая сборка
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ workers.dev
|
||||
<img width="415" height="138" alt="image" src="https://github.com/user-attachments/assets/58d8f83e-d8b5-40cf-a30f-741d7311047b" />
|
||||
|
||||
7. Скопируйте домен из поля справа и укажите его в настройках **Cloudflare Worker** (или через аргумент `--cfproxy-worker-domain`)
|
||||
* Пример домена: `random-symbols-1234.username.workers.dev`
|
||||
* Пример домена: `random-symbols-1234.username.workers.dev`
|
||||
* **Можно указывать несколько доменов через запятую (или повторением аргумента `--cfproxy-worker-domain`)**
|
||||
<img width="414" height="182" alt="image" src="https://github.com/user-attachments/assets/4fb0b111-8026-4d17-b993-6c70ec37f1f5" />
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
**Принудительно.** Для клиентов, которые сообщают тестовые DC как обычные 1-3
|
||||
(Telethon, TDLib) — распознать их автоматически нельзя. Тогда весь трафик
|
||||
принудительно направляется на тестовые DC (продовые аккаунты через этот прокси
|
||||
работать перестанут). Для принудительной работы замените в конфиге force_test_dc на true или используйте флаг `--force-test-dc` в CLI
|
||||
работать перестанут). Для принудительной работы используйте флаг `--force-test-dc` в CLI:
|
||||
|
||||
```bash
|
||||
tg-ws-proxy --force-test-dc # + ваши --secret / --port
|
||||
```
|
||||
|
||||
## Ограничения
|
||||
|
||||
Работает только для маршрутов **прямой DC → IP** и **Cloudflare Worker** (см. [Настройка Cloudflare Worker'а](./CfWorker.md)).
|
||||
Работает только для маршрутов **прямой DC → IP** и **Cloudflare Worker** (см. [Настройка Cloudflare Worker'а](./CfWorker.md)).
|
||||
+9
-5
@@ -27,8 +27,12 @@ from ui.i18n import (
|
||||
|
||||
log = logging.getLogger('tg-mtproto-proxy')
|
||||
|
||||
_CFPROXY_HELP_URL = "https://github.com/Flowseal/tg-ws-proxy/blob/main/docs/CfProxy.md"
|
||||
_CFWORKER_HELP_URL = "https://github.com/Flowseal/tg-ws-proxy/blob/main/docs/CfWorker.md"
|
||||
|
||||
def _get_doc_url(doc_name: str) -> str:
|
||||
from ui.i18n import get_language
|
||||
lang = get_language().value
|
||||
lang_folder = "EN" if lang == "en" else "RU"
|
||||
return f"https://github.com/Flowseal/tg-ws-proxy/blob/main/docs/{lang_folder}/{doc_name}.md"
|
||||
_CFPROXY_TEST_DCS = [1, 2, 3, 4, 5, 203]
|
||||
_CFWORKER_TEST_DST = {
|
||||
1: '149.154.175.50',
|
||||
@@ -402,7 +406,7 @@ def install_tray_config_form(
|
||||
text_color="#ffffff", border_width=0,
|
||||
command=lambda: (
|
||||
header.winfo_toplevel().iconify(),
|
||||
webbrowser.open("https://github.com/Flowseal/tg-ws-proxy/blob/main/docs/Funding.md"),
|
||||
webbrowser.open(_get_doc_url("Funding")),
|
||||
),
|
||||
).pack(side="right", padx=(0, 6))
|
||||
|
||||
@@ -605,7 +609,7 @@ def install_tray_config_form(
|
||||
font=(theme.ui_font_family, 14), corner_radius=8,
|
||||
fg_color=theme.tg_blue, hover_color=theme.tg_blue_hover,
|
||||
text_color="#ffffff", border_width=1, border_color=theme.field_border,
|
||||
command=lambda: webbrowser.open(_CFPROXY_HELP_URL),
|
||||
command=lambda: webbrowser.open(_get_doc_url("CfProxy")),
|
||||
).pack(side="right")
|
||||
|
||||
cfproxy_user_domain_var = ctk.StringVar(value=", ".join(saved_user_domains))
|
||||
@@ -696,7 +700,7 @@ def install_tray_config_form(
|
||||
font=(theme.ui_font_family, 14), corner_radius=8,
|
||||
fg_color=theme.tg_blue, hover_color=theme.tg_blue_hover,
|
||||
text_color="#ffffff", border_width=1, border_color=theme.field_border,
|
||||
command=lambda: webbrowser.open(_CFWORKER_HELP_URL),
|
||||
command=lambda: webbrowser.open(_get_doc_url("CfWorker")),
|
||||
).pack(side="right")
|
||||
|
||||
_cfworker_test_widget = ctk.CTkButton(
|
||||
|
||||
Reference in New Issue
Block a user