routedel

Delete, add, list and monitor IPv4 routes on Linux, with notifications to multiple ntfy and Growl (GNTP) servers.

Install

pip install routedel
pip install "routedel[clipboard]"   # optional: read route rows from the clipboard

Usage

routedel -l                                    # list routes
routedel -m 100                                # delete route(s) by metric
routedel 0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0   # delete a full `route -n` row
routedel 0.0.0.0 192.168.1.1 100 eth0          # legacy: X GW METRIC DEV (default route)
routedel c                                     # delete using a route row from the clipboard
sudo routedel -a 10.0.0.0/8 -g 192.168.1.1 -i eth0 --met 50   # add route
sudo routedel -a -d -g 192.168.1.1 -i eth0 --met 100          # add default route
routedel --monitor --refresh 2                 # live monitor, notifies on changes

Route changes need root.

Notifications

Any number of servers of each type. Via CLI (repeatable):

routedel -m 100 --ntfy https://ntfy.sh/my-routes --ntfy https://ntfy.example.com/alerts \
                --growl 192.168.1.10 --growl 192.168.1.20:23053

Or via a JSON config (first found wins): --config FILE, $ROUTEDEL_CONFIG, ~/.config/routedel/config.json, ~/.routedel.json. CLI targets are added to the config targets.

{
  "ntfy":  [{"url": "https://ntfy.sh", "topic": "my-routes", "token": "tk_xxx"},
            {"url": "https://ntfy.example.com", "topic": "alerts", "user": "u", "password": "p"}],
  "growl": [{"host": "192.168.1.10", "port": 23053, "password": "secret"},
            {"host": "192.168.1.20"}]
}

Test with routedel --test-notify. Disable with --no-notify. Servers are contacted in parallel; one failing server does not affect the others. Dependencies for notifications: none (stdlib urllib + raw GNTP 1.0 over sockets).

License

MIT

Development & release

pip install -e ".[dev]" && pytest
python -m build && twine check dist/*

Release to PyPI (GitHub Actions, Trusted Publishing — no token needed):

  1. On pypi.org → Publishing → add a pending publisher: owner cumulus13, repo routedel, workflow publish.yml, environment pypi. (Repeat on test.pypi.org with environment testpypi if wanted.)
  2. In the GitHub repo create environments pypi (and testpypi).
  3. Bump version in pyproject.toml and src/routedel/__init__.py, commit, then publish a GitHub Release tagged vX.Y.Z. The workflow tests, checks tag == version, builds and uploads.

Manual alternative: twine upload dist/* (API token).