Skip to main content

asmr-tg-backup proxy router extension

An optional, scope-aware network extension for asmr-tg-backup. It supports HTTP(S), SOCKS5/SOCKS5h endpoints and Clash-compatible subscription URLs via a locally managed Mihomo process.

The core asks for a route for each operation. The selected proxy endpoint stays fixed for the entire HTTP request, yt-dlp process, curl upload, or MTProto connection. If an operation fails, a later retry can choose another static endpoint; Mihomo's url-test group continuously selects a healthy subscription node for new connections.

Install and enable

asmr-tg-backup extensions enable proxy-router

The trusted core command installs the extension into the current pipx/virtual environment, asks only for the proxy source, endpoint, and routing preset, writes a private config, validates the complete runtime, and safely restarts a matching managed service. The defaults are local SOCKS5 at 127.0.0.1:7891 with proxy routing only for media probes and downloads.

For a container or another build-time-managed environment, install asmr-tg-backup-ext-proxy-router==0.2.0 in the image and then run the same enable command to create the private runtime configuration.

The following manual configuration remains available for advanced deployments.

Keep the plugin config outside the repository, for example ~/.config/asmr-tg-backup/proxy.toml, then reference it from the core config:

[extensions]
enabled = ["dreaife.proxy-router"]

[extensions."dreaife.proxy-router"]
required = true
config_file = "proxy.toml"

Run asmr-tg-backup extensions doctor before restarting the service.

Static SOCKS5 or HTTP proxy

fail_closed = true
routes = [
  "http://127.0.0.1:7890",
  "socks5h://127.0.0.1:7891",
]

[scopes]
"source.notification" = "proxy"
"media.probe" = "proxy"
"media.download" = "proxy"
"telegram.control.receive" = "direct"
"telegram.control.send" = "direct"
"telegram.delivery.bot_api" = "direct"
"telegram.delivery.mtproto" = "direct"

socks5h resolves destination host names through the proxy. A single endpoint can also be written as:

[static]
socks5_host = "127.0.0.1"
socks5_port = 7891

Every scope defaults to direct; installing the package does not turn proxying on implicitly. Each scope accepts direct, inherit, or proxy:

Scope Operation
origin.resolve Resolve a user-facing source reference such as a YouTube handle
source.notification Poll live/feed notifications
source.discovery Enumerate source media and refresh source credentials
media.probe One yt-dlp metadata probe process
media.download One complete yt-dlp download/live-recording process
telegram.control.receive Bot API getUpdates
telegram.control.send Control-bot API responses
telegram.delivery.bot_api Bot API media upload through curl
telegram.delivery.mtproto One persistent Telethon connection

With fail_closed = true, a proxy-scoped operation never silently falls back to the direct network.

Clash-compatible subscription through Mihomo

Install a mihomo executable and keep the private HTTPS subscription URL in an environment file:

export ASMR_PROXY_SUBSCRIPTION_URL='https://provider.example/private-token'
[mihomo]
enabled = true
binary = "mihomo"
subscription_url_env = "ASMR_PROXY_SUBSCRIPTION_URL"
listen_host = "127.0.0.1"
listen_port = 17891
refresh_seconds = 3600
health_check_seconds = 300

[scopes]
"media.probe" = "proxy"
"media.download" = "proxy"

The generated Mihomo configuration and log are stored with owner-only permissions below the core data directory. The subscription URL is never printed by this extension. Mihomo performs provider refresh, health checks, and automatic url-test node selection.

Important boundaries

  • The core never swaps the configured endpoint inside a running yt-dlp process. With a Mihomo subscription, an existing TCP connection remains on its node, while a newly opened fragment connection may use Mihomo's newly selected healthy node. A full core retry also obtains a new route lease.
  • A Bot API upload never switches after sending begins, which preserves the delivery uncertainty boundary and avoids duplicate messages.
  • MTProto routing is connection-scoped and changes only after reconnecting.
  • If telegram.bot_api.api_base points to a loopback Telegram Bot API daemon, the Python service always connects to that daemon directly. Proxy the daemon's own Telegram egress at the container, process, or network-namespace layer; this extension cannot alter another process's sockets.
  • inherit preserves legacy environment behavior for HTTP/curl/yt-dlp, but an explicit direct or proxy mode is easier to audit.

Compatibility

  • Extension API level: 1
  • Core: asmr-tg-backup >=0.6,<0.7
  • Python: 3.11 or newer
  • Optional subscription backend: Mihomo

Licensed under Apache-2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz.

File metadata

File hashes

Hashes for asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e29d5f617725f2672d4570b61612e3721e4b4950c428b45684a271e50eca1339
MD5 86381cfdd50061f10f076d43eddc254b
BLAKE2b-256 5252e01b7e1fb0191f740b4855e7dba9ed995d8f9b2438f101cf82b5b4abe4b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz:

Publisher: publish-pypi.yml on dreaifekks/asmr-tg-backup-ext-proxy-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfd510c795d35ec5232ad220f882b519b0421a4b6d7845d71ef639f1c8636ecc
MD5 20c336b6a0a3919e9b0949bf6d235b31
BLAKE2b-256 511f054c23ef1798acdb1733644e496af17e75b3e698bd8e3758da0ca380af3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on dreaifekks/asmr-tg-backup-ext-proxy-router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page