routedel 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- routedel-1.0.3/.github/workflows/ci.yml +44 -0
- routedel-1.0.3/.github/workflows/publish.yml +74 -0
- routedel-1.0.3/.github/workflows/release.yml +25 -0
- routedel-1.0.3/.gitignore +15 -0
- routedel-1.0.3/CHANGELOG.md +8 -0
- routedel-1.0.3/LICENSE +21 -0
- routedel-1.0.3/MANIFEST.in +1 -0
- routedel-1.0.3/PKG-INFO +111 -0
- routedel-1.0.3/README.html +1300 -0
- routedel-1.0.3/README.md +82 -0
- routedel-1.0.3/VERSION +1 -0
- routedel-1.0.3/pyproject.toml +69 -0
- routedel-1.0.3/src/routedel/__init__.py +10 -0
- routedel-1.0.3/src/routedel/__main__.py +12 -0
- routedel-1.0.3/src/routedel/cli.py +150 -0
- routedel-1.0.3/src/routedel/display.py +109 -0
- routedel-1.0.3/src/routedel/notify.py +137 -0
- routedel-1.0.3/src/routedel/routes.py +148 -0
- routedel-1.0.3/tests/test_cli.py +110 -0
- routedel-1.0.3/tests/test_notify.py +160 -0
- routedel-1.0.3/tests/test_routes.py +108 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
cache: pip
|
|
21
|
+
- name: Install
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install -e ".[dev]"
|
|
25
|
+
- name: Test
|
|
26
|
+
run: pytest -q
|
|
27
|
+
|
|
28
|
+
build:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
needs: test
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-python@v5
|
|
34
|
+
with:
|
|
35
|
+
python-version: "3.12"
|
|
36
|
+
- name: Build and check distribution
|
|
37
|
+
run: |
|
|
38
|
+
python -m pip install --upgrade pip build twine
|
|
39
|
+
python -m build
|
|
40
|
+
twine check dist/*
|
|
41
|
+
- uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trigger: publish a GitHub Release (tag must match the version in pyproject.toml, e.g. v1.0.0),
|
|
4
|
+
# or run manually (workflow_dispatch) to publish to TestPyPI.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Install deps
|
|
19
|
+
run: |
|
|
20
|
+
python -m pip install --upgrade pip build twine
|
|
21
|
+
pip install -e ".[dev]"
|
|
22
|
+
- name: Test
|
|
23
|
+
run: pytest -q
|
|
24
|
+
- name: Verify tag matches package version
|
|
25
|
+
if: github.event_name == 'release'
|
|
26
|
+
run: |
|
|
27
|
+
VERSION=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
28
|
+
TAG="${GITHUB_REF_NAME#v}"
|
|
29
|
+
[ "$VERSION" = "$TAG" ] || { echo "Tag $GITHUB_REF_NAME != version $VERSION"; exit 1; }
|
|
30
|
+
- name: Build
|
|
31
|
+
run: |
|
|
32
|
+
python -m build
|
|
33
|
+
twine check dist/*
|
|
34
|
+
- uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
|
|
39
|
+
publish-pypi:
|
|
40
|
+
if: github.event_name == 'release'
|
|
41
|
+
needs: build
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
environment:
|
|
44
|
+
name: pypi
|
|
45
|
+
url: https://pypi.org/project/routedel/
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write # PyPI Trusted Publishing (OIDC)
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
54
|
+
# Fallback to an API token instead of Trusted Publishing:
|
|
55
|
+
# with:
|
|
56
|
+
# password: ${{ secrets.PYPI_API_TOKEN }}
|
|
57
|
+
|
|
58
|
+
publish-testpypi:
|
|
59
|
+
if: github.event_name == 'workflow_dispatch'
|
|
60
|
+
needs: build
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
environment:
|
|
63
|
+
name: testpypi
|
|
64
|
+
url: https://test.pypi.org/project/routedel/
|
|
65
|
+
permissions:
|
|
66
|
+
id-token: write
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/download-artifact@v4
|
|
69
|
+
with:
|
|
70
|
+
name: dist
|
|
71
|
+
path: dist/
|
|
72
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
73
|
+
with:
|
|
74
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- run: pip install build
|
|
20
|
+
- run: python -m build
|
|
21
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
22
|
+
- uses: softprops/action-gh-release@v2
|
|
23
|
+
with:
|
|
24
|
+
files: dist/*
|
|
25
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
- Packaged for PyPI (src layout, `routedel` console script).
|
|
5
|
+
- ntfy and Growl (GNTP 1.0) notifications, multiple servers, parallel send.
|
|
6
|
+
- `--add` / `--default` implemented; non-default routes deleted with correct dest/netmask.
|
|
7
|
+
- `ip route` preferred, `route -n` fallback; no shell (`subprocess` list args).
|
|
8
|
+
- Monitor notifies on route add/remove, start and stop.
|
routedel-1.0.3/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hadi Cahyadi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include README.md LICENSE CHANGELOG.md config.example.json
|
routedel-1.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: routedel
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Delete, add, list and monitor IPv4 routes, with ntfy and Growl (GNTP) notifications to multiple servers.
|
|
5
|
+
Project-URL: Homepage, https://github.com/cumulus13/routedel
|
|
6
|
+
Project-URL: Issues, https://github.com/cumulus13/routedel/issues
|
|
7
|
+
Author-email: Hadi Cahyadi <cumulus13@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: cli,gntp,growl,monitor,network,ntfy,route,routing
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: System :: Networking
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: rchf
|
|
20
|
+
Requires-Dist: rich>=13.0
|
|
21
|
+
Requires-Dist: richcolorlog
|
|
22
|
+
Provides-Extra: clipboard
|
|
23
|
+
Requires-Dist: clipboard; extra == 'clipboard'
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
27
|
+
Requires-Dist: twine; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# routedel
|
|
31
|
+
|
|
32
|
+
Delete, add, list and monitor IPv4 routes on Linux, with notifications to **multiple ntfy and Growl (GNTP) servers**.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install routedel
|
|
38
|
+
pip install "routedel[clipboard]" # optional: read route rows from the clipboard
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
routedel -l # list routes
|
|
45
|
+
routedel -m 100 # delete route(s) by metric
|
|
46
|
+
routedel 0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0 # delete a full `route -n` row
|
|
47
|
+
routedel 0.0.0.0 192.168.1.1 100 eth0 # legacy: X GW METRIC DEV (default route)
|
|
48
|
+
routedel c # delete using a route row from the clipboard
|
|
49
|
+
sudo routedel -a 10.0.0.0/8 -g 192.168.1.1 -i eth0 --met 50 # add route
|
|
50
|
+
sudo routedel -a -d -g 192.168.1.1 -i eth0 --met 100 # add default route
|
|
51
|
+
routedel --monitor --refresh 2 # live monitor, notifies on changes
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Route changes need root.
|
|
55
|
+
|
|
56
|
+
## Notifications
|
|
57
|
+
|
|
58
|
+
Any number of servers of each type. Via CLI (repeatable):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
routedel -m 100 --ntfy https://ntfy.sh/my-routes --ntfy https://ntfy.example.com/alerts \
|
|
62
|
+
--growl 192.168.1.10 --growl 192.168.1.20:23053
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or via a JSON config (first found wins): `--config FILE`, `$ROUTEDEL_CONFIG`,
|
|
66
|
+
`~/.config/routedel/config.json`, `~/.routedel.json`. CLI targets are added to the config targets.
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"ntfy": [{"url": "https://ntfy.sh", "topic": "my-routes", "token": "tk_xxx"},
|
|
71
|
+
{"url": "https://ntfy.example.com", "topic": "alerts", "user": "u", "password": "p"}],
|
|
72
|
+
"growl": [{"host": "192.168.1.10", "port": 23053, "password": "secret"},
|
|
73
|
+
{"host": "192.168.1.20"}]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Test with `routedel --test-notify`. Disable with `--no-notify`.
|
|
78
|
+
Servers are contacted in parallel; one failing server does not affect the others.
|
|
79
|
+
Dependencies for notifications: none (stdlib `urllib` + raw GNTP 1.0 over sockets).
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT
|
|
84
|
+
|
|
85
|
+
## Development & release
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install -e ".[dev]" && pytest
|
|
89
|
+
python -m build && twine check dist/*
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Release to PyPI (GitHub Actions, Trusted Publishing — no token needed):
|
|
93
|
+
|
|
94
|
+
1. On pypi.org → *Publishing* → add a pending publisher: owner `cumulus13`, repo `routedel`,
|
|
95
|
+
workflow `publish.yml`, environment `pypi`. (Repeat on test.pypi.org with environment `testpypi` if wanted.)
|
|
96
|
+
2. In the GitHub repo create environments `pypi` (and `testpypi`).
|
|
97
|
+
3. Bump `version` in `pyproject.toml` and `src/routedel/__init__.py`, commit, then publish a
|
|
98
|
+
GitHub Release tagged `vX.Y.Z`. The workflow tests, checks tag == version, builds and uploads.
|
|
99
|
+
|
|
100
|
+
Manual alternative: `twine upload dist/*` (API token).
|
|
101
|
+
|
|
102
|
+
## 👤 Author
|
|
103
|
+
|
|
104
|
+
[Hadi Cahyadi](mailto:cumulus13@gmail.com)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
[](https://www.buymeacoffee.com/cumulus13)
|
|
108
|
+
|
|
109
|
+
[](https://ko-fi.com/cumulus13)
|
|
110
|
+
|
|
111
|
+
[Support me on Patreon](https://www.patreon.com/cumulus13)
|