This tool is a specialized network utility designed to maintain internet connection stability by proactively managing bandwidth usage.
Some internet connections (especially certain ISP configurations, long-range wireless links, or congested shared channels) suffer from "packet collisions" or degradation when the connection is idle or has low traffic. This manifests as packet loss, high latency, or complete drops during light usage.
The Solution: "Jerk" the connection awake. By forcing high-throughput traffic, we force the network hardware (modems, ISP switches) to prioritize the active stream, renegotiate channel parameters, and clear out collision states.
This tool implements an intelligent state machine to fix the connection only when necessary, avoiding wasted bandwidth.
-
🔍 Monitoring (Check Phase)
- Every cycle, the tool performs a 5-second sample download from a high-speed target (ThinkBroadband).
- It measures the real-time throughput.
-
🧠 Decision Logic
- Threshold:
30 Mbps - Case A (Healthy): If speed is ≥ 30 Mbps, the connection is considered good.
- Action: Sleep for 1 hour. The tool stays quiet.
- Case B (Degraded): If speed is < 30 Mbps, the connection is considered "colliding" or unstable.
- Action: Enter Saturation Mode.
- Threshold:
-
🌊 Saturation Mode (The Fix)
- The tool opens 8 concurrent, high-speed download streams.
- This saturates the bandwidth (typically reaching 100-200+ Mbps).
- Recovery Condition: It keeps saturating until the speed stays above 30 Mbps for at least 15 continuous seconds.
- Crash Guard: If saturation does not improve by at least 1 Mbps for 2 minutes, the process exits with code
101so an external watchdog can restart/report it. - Once recovered, it returns to the Sleep cycle.
Ensure you have Rust installed.
cargo build --releaseRun the binary directly:
./target/release/two-ip-ruOr via Cargo:
cargo run --releaseThe easiest way to produce a Windows .exe from macOS is to let GitHub Actions build it.
This repo includes a workflow at .github/workflows/build.yml that uploads:
two-ip-ru.exetwo-ip-ru-gui.exe
By default, it targets ThinkBroadband's speed test file. You can override this by passing a URL as an argument:
./target/release/two-ip-ru https://example.com/large-file.binWhen using cargo run, remember to pass args after --:
cargo run --release -- https://example.com/large-file.binThe behavior is controlled by constants in src/main.rs:
THRESHOLD_MBPS: Speed required to be considered "Healthy" (Default:30.0).SLEEP_DURATION: How long to rest after a healthy check (Default:3600s/ 1 hour).CHECK_DURATION: Duration of the initial speed sample (Default:5s).STREAMS: Number of parallel download connections (Default:8).SATURATION_STAGNATION_TIMEOUT: Maximum saturation time without meaningful growth (Default:120s).SATURATION_MIN_GROWTH_MBPS: Growth required to reset the stagnation timer (Default:1.0Mbps).
The tool logs all actions with timestamps for easy debugging:
[2024-01-31 12:00:00] CHECKING: Measuring current speed (5s sample)...
Current: 45.20 Mbps
[2024-01-31 12:00:05] OK: Speed is 45.20 Mbps. Sleeping for 1 hour...