Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

Feature: direct-to-DC mode (bypass Telegram middle proxy for lower latency) #53

@dvershinin

Description

@dvershinin

Feature Request

Requested by @PentiumB in #41

Add a mode where the proxy connects directly to Telegram DCs instead of going through Telegram's middle-end proxy relay servers (listed in proxy-multi.conf).

Current Architecture

Client → MTProxy → Telegram ME relay (proxy-multi.conf) → Telegram DC

The middle-end (ME) relay servers handle DC routing and enable ad tags (-P proxy tag). But they add an extra network hop.

Proposed Architecture (direct mode)

Client → MTProxy → Telegram DC (direct)

Benefits

  • Lower latency: One fewer network hop
  • No dependency on proxy-multi.conf: DC addresses are well-known and stable (149.154.175.0/24, etc.)
  • No dependency on core.telegram.org: Eliminates the startup/refresh download of proxy-multi.conf
  • Simpler deployment: No cron job needed for config refresh

Trade-offs

  • No ad tag support: Promoted channels (-P flag) require the ME relay
  • DC routing: The proxy must parse the MTProto stream to determine which DC the client wants, and handle DC migration
  • Potentially less reliable: Telegram's ME relays may handle load balancing and failover

Prior Art

  • mtg v2: Connects directly to Telegram DCs by default. Explicitly removed ad tag support and ME relay dependency to simplify architecture.
  • telemt: Supports both modes (ME relay with ad tags, and direct)

Implementation Notes

  • Could be toggled via --direct flag or activated when -P (proxy tag) is not specified
  • Well-known DC addresses: 149.154.175.50 (DC1), 149.154.167.51 (DC2), 149.154.175.100 (DC3), 149.154.167.91 (DC4), 91.108.56.100 (DC5)
  • Must handle DC identifier from the MTProto obfuscation handshake (embedded in the 64-byte frame)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions