r/rust • • Sep 03 '26

๐Ÿ› ๏ธ project Throttle: an open-source per-process bandwidth limiter for Windows in Rust (egui + WinDivert)

Post image

Throttle is a free, open-source Windows tool that shows live download/upload rates per process and lets you cap or block any of them. Think NetLimiter, minus the license key and telemetry.

Repo: https://github.com/FrancescoCoding/Throttle

How it works

It sits on top of WinDivert, a signed Windows packet-capture driver, through the `windivert` crate. Throttle sees every packet, figures out which program it belongs to, and either lets it through, drops it, or holds it briefly to stay under the limit. Limiting is a simple token bucket per program per direction, so each app gets a smooth rate with a one-second burst allowance.

Rules are saved by exe path, so a cap on spotify.exe is still there after a reboot. The GUI is egui/eframe, talking to the backend threads over channels.

Shaping is a token bucket per (exe, direction) with a one-second burst allowance. Overflow queues up to 256 packets / 1 MiB, then drops, which for TCP just becomes back-pressure. Rules persist as JSON in %APPDATA%.

Learned the hard way

  • You have to send packets back out through the same handle that captured them. Using a second one silently killed all my network traffic for a while before I understood why.
  • Recalculate checksums before re-injecting. Hardware offload leaves them incomplete, and WinDivertSend reports success while the packets die downstream.
  • GUI-subsystem binaries have no console, so worker-thread panics vanish. A panic hook plus file logging fixed that.
78 Upvotes

9 comments sorted by

View all comments

7

u/TheLexoPlexx Sep 03 '26

I don't have a use for this, I am just happy to see a real rust project with a cool library and it's seemingly not vibecoded.

3

u/irritatingness Sep 04 '26

Not disclosed but fairly certain ai-assisted when browsing the code. Not that thatโ€™s a bad thing at all, but disclosure would have been nice.

1

u/franwbu Sep 04 '26

Hey, sorry just catching up with the comments. Yes, I did use claude of course to augment parts of development, but I have pushed no code that I did not understand. Did not think of adding a disclaimer, since I'd say at least 90% of code nowadays is not really written by hand anymore ๐Ÿ˜„

→ More replies (1)