Skip to main content

routeopt

Crates.io Crates.io Downloads npm version npm downloads PyPI version PyPI downloads rust tests code-quality license PRs

Route Optimizer (routeopt) is a cross-platform CDN route optimizer with a mouse-driven TUI and dynamic OS firewall blocking.

Other Languages: English | 繁體中文 | 简体中文

Highlights

  • Monitors active TCP connections across one or more target processes and configurable ports, probing CDN node latency, jitter, and reachability.
  • Dynamically blocks slow or unstable CDN nodes using native OS firewalls (Windows Filtering Platform per-app rules on Windows, pf anchor rules on macOS).
  • Runs strictly in the foreground with session-ephemeral cooldowns and no background daemon or auto-startup; exiting or closing the terminal clears every firewall rule and leaves a clean slate for the next session.
  • Keeps the headless core and platform layers (src/core/, src/platform/) completely decoupled from the TUI (src/tui/) and CLI (src/cli/) so future GUI frontends can share the same engine.
  • Supports --dry-run mode for safe inspection without modifying OS firewall rules.

Installation

Prebuilt binaries and registry packages (GitHub Releases, crates.io, npm, and PyPI) are published when v* release tags are cut. Until the first release is published, build from source with Cargo:

git clone https://github.com/Mai0313/routeopt.git
cd routeopt
cargo build --release --locked

Once published, the routeopt CLI can also be installed via Cargo, npm, or PyPI:

cargo install routeopt
# or
npm install -g routeopt
# or
uv tool install routeopt

Usage

# Run with the mouse-driven Compact TUI (requires Administrator on Windows or sudo on macOS for live blocking)
routeopt --target douyin

# Inspect connections and latency probes without modifying OS firewall rules
routeopt --target douyin --dry-run

# Monitor multiple targets and ports
routeopt --target douyin --target bilibili --port 443 --port 8443

# Run headless without the TUI and stream engine events to stdout
routeopt --target douyin --headless

# Run a one-shot TCP latency/jitter probe without touching OS firewall rules
routeopt --probe 1.1.1.1
routeopt --probe 1.1.1.1:8443

# Display version and build metadata
routeopt --version

CLI Options

Flag Description
-V, --version Print build version metadata and exit.
--dry-run Monitor connections and probe nodes without modifying OS firewall rules.
--headless Run without the interactive TUI and stream engine events to stdout.
-t, --target <NAME> Target process name to monitor (repeatable; overrides targets in config.json).
--app-path <TARGET=PATH> Explicit executable path override for per-app firewall filtering (repeatable).
-p, --port <PORT> Remote TCP port to monitor (repeatable; defaults to 443).
--config-dir <DIR> Override the directory used for config.json (preferences only; no block carryover).
--max-latency <MS> Override the maximum latency threshold in milliseconds (default: 150).
--max-jitter <MS> Override the maximum jitter threshold in milliseconds (default: 100).
--cooldown <MIN> Override the session block cooldown duration in minutes (default: 30).
--probe <IP[:PORT]> Run a one-shot TCP probe against IP (default port 443) or IP:PORT without touching OS firewall rules.
--no-auto-block Start with automatic blocking paused.
--no-ipv6 Disable IPv6 monitoring and blocking.

TUI Mouse & Keybindings

The Compact TUI supports full mouse interaction across all four tabs (Monitor, Subnets, Events, Settings) as well as keyboard shortcuts:

Control Action
Mouse Click Switch tabs, select rows, sort columns, toggle filters/settings, and click Inspector or Subnet action buttons.
Mouse Wheel Scroll the active Nodes table, Subnets list, or Events log.
1-4 / Tab / Shift+Tab Switch between Monitor, Subnets, Events, and Settings tabs.
Up / k, Down / j Move selection or scroll in the active view.
Space Toggle automatic blocking (ACTIVE / PAUSED).
u / b / r Unblock / manually block / re-probe the selected node (or release/quarantine on Subnets).
c Clear all active session firewall rules and cooldowns.
6 / s Toggle IPv6 monitoring / toggle subnet quarantine (/24 IPv4, /48 IPv6).
+ / = / - Increase or decrease the max latency threshold by 25ms.
a / p Add a custom target process name or custom TCP port on the Settings tab.
? / Esc Open or close the Help modal; Esc closes modals/inputs and never quits.
q / Ctrl+C Quit cleanly and immediately release every firewall rule created by the session.

Version Information

The binary embeds dynamic build metadata via build.rs, including git tag version, commit count, short hash, dirty state, and Rust/Cargo versions.

Example output:

routeopt v0.1.0-2-gf4ae332-dirty
Built with Rust 1.99.1 and Cargo 1.99.1

Docker

docker build -f docker/Dockerfile --target prod -t ghcr.io/mai0313/routeopt:latest .
docker run --rm ghcr.io/mai0313/routeopt:latest --version

Development

Contributor setup, commands, tests, code conventions, CI, and release details live in CONTRIBUTING.md. Architecture and runtime invariants are documented in AGENTS.md.

License

MIT (see LICENSE).

Metadata

Release files for routeopt 0.1.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 routeopt 0.1.0
File Size Uploaded Provenance Actions
routeopt-0.1.0.tar.gz 5.4 MB Without provenance Details for routeopt-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for routeopt 0.1.0
File Interpreter ABI Platform Actions
routeopt-0.1.0-py3-none-any.whl Python 3 none any Details for routeopt-0.1.0-py3-none-any.whl

Total release size: 10.7 MB

Release files / routeopt-0.1.0.tar.gz

Download URL routeopt-0.1.0.tar.gz
Size 5.4 MB
Tags Source
SHA-256 checksum
How to use checksums
b84431ec12db04307558692ebf0c0cf61e10ea2f6c7f1c77e2ada288b5a5e940
BLAKE2b-256 checksum
How to use checksums
d6537c2247a0dd8a635252ea04e60cec106f9da5501e7ff2c4fd1752b04d85cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / routeopt-0.1.0-py3-none-any.whl

Download URL routeopt-0.1.0-py3-none-any.whl
Size 5.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
cf7727dbfd734cf53669e1fc58d8ca7fedc3796c14822f79e9c9e1fa926a3a2c
BLAKE2b-256 checksum
How to use checksums
89192befbdf332ac93dd350ce51f166bd056eba51c8e69e5556e5c0bc2f5e922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for routeopt 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.1.0 This release

2 release files No 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