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.

Metadata

Release files for asmr-tg-backup-ext-proxy-router 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asmr-tg-backup-ext-proxy-router 0.2.0
File Size Uploaded Provenance Actions
asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz 16.8 kB With provenance Details for asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asmr-tg-backup-ext-proxy-router 0.2.0
File Interpreter ABI Platform Actions
asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl Python 3 none any Details for asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl

Total release size: 34.3 kB

Release files / asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz

Download URL asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e29d5f617725f2672d4570b61612e3721e4b4950c428b45684a271e50eca1339
BLAKE2b-256 checksum
How to use checksums
5252e01b7e1fb0191f740b4855e7dba9ed995d8f9b2438f101cf82b5b4abe4b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release files / asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl

Download URL asmr_tg_backup_ext_proxy_router-0.2.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfd510c795d35ec5232ad220f882b519b0421a4b6d7845d71ef639f1c8636ecc
BLAKE2b-256 checksum
How to use checksums
511f054c23ef1798acdb1733644e496af17e75b3e698bd8e3758da0ca380af3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Security for asmr-tg-backup-ext-proxy-router 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for asmr_tg_backup_ext_proxy_router-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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