Skip to content

Announce the NAT-ed public address to the Telegram middle-ends. - #4

Open
tral wants to merge 1 commit into
telegramdesktop:masterfrom
tral:announce-nat-address
Open

Announce the NAT-ed public address to the Telegram middle-ends.#4
tral wants to merge 1 commit into
telegramdesktop:masterfrom
tral:announce-nat-address

Conversation

@tral

@tral tral commented Aug 22, 2026

Copy link
Copy Markdown

Official MTProxy puts the address of its own interface in the RPC handshake it sends to each middle-end. On a cloud instance whose public address is NAT-ed onto a private interface address, that announcement does not match the source address Telegram observes, and every middle-end closes the connection immediately after the handshake completes.

MTProxy reconnects with no backoff. On an Oracle Cloud instance with a 10.0.0.0/24 interface address this produced 3565 outbound connections in 15 seconds, which exhausted the host conntrack table within a minute; the kernel then dropped packets for every service on the host, so the relay could not reach its own backend either. The visible symptom is a client that reports the proxy as online and never finishes connecting.

Derive --nat-info from the interface address that routes to a real proxy_for target and from the hostname's A record, which is by definition this server's public address because Caddy could not otherwise obtain a certificate for it. --public-ip overrides the resolved value. With the mapping in place the same 15 seconds opened 76 connections and closed none.

Official MTProxy puts the address of its own interface in the RPC
handshake it sends to each middle-end. On a cloud instance whose public
address is NAT-ed onto a private interface address, that announcement does
not match the source address Telegram observes, and every middle-end
closes the connection immediately after the handshake completes.

MTProxy reconnects with no backoff. On an Oracle Cloud instance with a
10.0.0.0/24 interface address this produced 3565 outbound connections in
15 seconds, which exhausted the host conntrack table within a minute; the
kernel then dropped packets for every service on the host, so the relay
could not reach its own backend either. The visible symptom is a client
that reports the proxy as online and never finishes connecting.

Derive --nat-info from the interface address that routes to a real
proxy_for target and from the hostname's A record, which is by definition
this server's public address because Caddy could not otherwise obtain a
certificate for it. --public-ip overrides the resolved value. With the
mapping in place the same 15 seconds opened 76 connections and closed
none.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant