Skip to content

fix(gateway): keep DoH-confirmed Telegram IPs that match system DNS (salvage #17043)#20175

Merged
teknium1 merged 1 commit into
mainfrom
salvage/pr-17043
May 5, 2026
Merged

fix(gateway): keep DoH-confirmed Telegram IPs that match system DNS (salvage #17043)#20175
teknium1 merged 1 commit into
mainfrom
salvage/pr-17043

Conversation

@teknium1

@teknium1 teknium1 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Salvages @0xsir0000's PR #17043 onto current main. Fixes #14520.

What it does

discover_fallback_ips() excluded any DoH-resolved IP that also appeared in the system resolver's answer set, on the assumption that the system IP was unreachable. When DoH and system DNS agreed (common case), the function returned the hardcoded _SEED_FALLBACK_IPS instead — and on networks where those seeds aren't routable, the Telegram fallback transport had nothing usable.

Changes

  • gateway/platforms/telegram_network.py — drop the system_ips exclusion. DoH-confirmed IPs are preserved regardless of system-DNS overlap; a transient primary-path failure now retries against the same IP via the rewrite path before escalating to seeds.
  • tests/gateway/test_telegram_network.py — updated two tests that codified the old exclusion.

Validation

tests/gateway/test_telegram_network.py — 46 passed locally.

Closes #17043 via salvage.

…14520)

discover_fallback_ips() filtered out any DoH-resolved IP that also appeared
in the system resolver's answer set, on the assumption that the system IP
was unreachable. When DoH and system DNS agreed (a common case), the
function returned the hardcoded _SEED_FALLBACK_IPS list instead — and on
networks where those seed addresses are not routable, the Telegram fallback
transport had nothing usable to retry against and polling failed.

Drop the system_ips exclusion so DoH-confirmed IPs are preserved regardless
of system DNS overlap. The TelegramFallbackTransport already tries the
primary path first via system DNS, then falls through to the IP-rewrite
path on connect failure; including the same IP in both lanes lets a
transient primary failure recover via the explicit IP route instead of
escalating to seed addresses.

Update the two tests that codified the old exclusion to reflect the new,
inclusion-by-default behaviour.

Fixes #14520
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter labels May 5, 2026
@teknium1 teknium1 merged commit f6b68f0 into main May 5, 2026
10 of 11 checks passed
@teknium1 teknium1 deleted the salvage/pr-17043 branch May 5, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram polling fails when DoH returns same IP as system DNS

3 participants