Skip to content

sigmaSd/Eltrafico

Repository files navigation

Eltrafico

NetLimiter-like traffic shaping for Linux

This is a port of https://github.com/cryzed/TrafficToll to rust.

And a gui on top

With network usage:

The repo have the gtk frontend among others, other frontends can be written:

The easiest one to test is bandito, since it provides appimages (that bundles all runtime dependencies) in the github ci

Usage

eltrafico

Howto

Choose the correct interface, and eltrafico will monitor it for active connections

Active program will automatically show up

Choose your limits then activate it by toggling the corresponding checkbox on.

If bandwhich or nethogs is installed on your system, eltrafico will use it automatically to show programs live network usage

You can run eltrafico with --advanced flag to get more options in the gui

Technical details

Eltrafico is split on 2 crates that communicate through stdin/out:

1- crates/gui: create gui and call bandwhich/nethogs and eltrafico_tc as privileged process using pkexec

2- crates/tc: traffic shaping, can be controlled via stdin, for the list of commands see (TODO)https://github.com/sigmaSd/Eltrafico/blob/sudo_isolation/src/eltrafico_tc/main.rs#L252 and (TODO)https://github.com/sigmaSd/Eltrafico/blob/sudo_isolation/src/eltrafico_tc/main.rs#L79

This allows to run the gui as a normal user, and ask for higher privilege only for eltrafico_tc and bandwhich/nethogs binaries

eltrafico_tc needs to be in $PATH or you can specify a custom path via --eltrafico-tc $path_to_binary

pkexec usage:

  • pkexec eltrafico_tc
  • pkexec bandhwich
  • pkexec nethogs
  • pkexec pkill nethogs
  • pkexec pkill bandwhich

Hacking tips

When developping make sure to use env RUST_LOG=debug

Current State

Works on my pc (TM)

Dependencies

  • iproute2

optional:

Binary Releases

Community Packages

Installation

Building/Dev

Its a good idea to set RUST_LOG=trace when devoloping