Commit Graph

16 Commits

Author SHA1 Message Date
6392131577 style: satisfy the widened ruff default rule set
ruff 0.16 enables rules that earlier releases did not, so `ruff check .`
was already failing on HEAD with 35 findings - the CI job installs ruff
unpinned and would have gone red on the next push regardless of this
branch.

All changes are mechanical and behaviour-neutral:

- Optional[X] -> X | None, List[str] -> list[str], dropped the now unused
  typing imports (every module already carries
  `from __future__ import annotations`, and requires-python is >= 3.10).
- Sorted import blocks, `import automtu.x as x` -> `from automtu import x`.
- subprocess.run in pmtu.py and wg.py now passes check=False explicitly.
  That is the parameter default, so the calls behave exactly as before.
- int(round(x)) -> round(x): round() with a single argument already
  returns int.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 18:42:55 +02:00
499e61346d fix(net): detect interfaces without following /sys symlinks
/sys/class/net/<if> is always a symlink into /sys/devices; in nested
containers (sysbox runtime) that target is not visible, so the link is
dead. iface_exists() used Path.exists(), which follows the link and
therefore tested the visibility of the target instead of the existence of
the interface. detect_egress_iface() discarded every interface it had
correctly read from the routing table, so automtu aborted with "Could not
detect egress interface" and rc=2 even though `ip -4 route show default`
and `ip link show dev eth0` both worked. The documented escape hatch
--egress-if was equally dead, because core.py validates it through the
same call.

Chosen fix: os.path.lexists() rather than probing netlink for existence.
It asks the right question -- "is there an entry named <if>" -- and costs
no subprocess on a healthy host. Netlink (`ip link show`) is only the
fallback for when /sys/class/net itself is unavailable, so sysfs stays the
preferred path everywhere.

read_iface_mtu() gains the same cascade: sysfs first, MTU parsed from
`ip link show dev <if>` when the sysfs path is unreadable, RuntimeError
naming both sources when neither answers - no silent default. core.py
turns that into an error line plus rc=3 instead of a traceback.

list_ifaces() had the same defect (is_dir() on a dead symlink) and would
have left Docker bridge detection blind in the same environments.

Regression tests build a /sys replacement whose class/net/eth0 points at a
missing target and mock the ip command: they fail if lexists becomes
exists again, if the MTU fallback is removed, or if the symlink filter is
dropped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 18:35:25 +02:00
a0db5f797f Release version 1.1.0
Some checks failed
CI / test-and-lint (push) Has been cancelled
2026-01-23 10:56:44 +01:00
fc5dee4dc0 feat: add Docker MTU apply support and docker-ordered persistence
https://chatgpt.com/share/69733e45-96ec-800f-9aad-0cac7306dedd
2026-01-23 10:53:29 +01:00
f534d025d0 feat(persist): add systemd persistence backend with uninstall
https://chatgpt.com/share/69733e45-96ec-800f-9aad-0cac7306dedd
2026-01-23 10:23:59 +01:00
77da7a4acb Added Mirrors and ignored build artefacts
Some checks failed
CI / test-and-lint (push) Has been cancelled
2026-01-21 19:18:07 +01:00
cd5fcdab44 Release version 1.0.0
Some checks failed
CI / test-and-lint (push) Has been cancelled
v1.0.0
2026-01-21 19:16:21 +01:00
959c594d37 docs(readme): add polished installation, usage, automation examples and author info
https://chatgpt.com/share/697112b2-0410-800f-93ff-9372b603d43f
2026-01-21 19:10:08 +01:00
2bf7117296 feat(output): add machine-readable MTU output modes (single number + JSON)
https://chatgpt.com/share/697112b2-0410-800f-93ff-9372b603d43f
2026-01-21 19:06:47 +01:00
dcc7a68973 refactor: convert script to automtu package with CI workflow
https://chatgpt.com/share/697112b2-0410-800f-93ff-9372b603d43f
2026-01-21 18:53:44 +01:00
78da3ffc73 Added funding 2026-01-21 17:54:47 +01:00
ccd7c6534f Ignored pycache 2025-10-16 11:19:57 +02:00
0965221e22 docs: add comprehensive practical guide for wg-mtu-auto usage and configuration
This guide explains how to determine and set correct MTU values with and without WireGuard.
It includes examples for automatic detection, PMTU probing, egress application, and WireGuard overrides.

Reference: conversation about wg-mtu-auto practical usage and testing at https://chatgpt.com/share/68efc179-1a10-800f-9656-1e8731b40546
2025-10-16 11:09:50 +02:00
c15127b6ab Add --apply-egress-mtu option and corresponding unittests to allow automatic MTU adjustment on egress interface before setting WireGuard MTU
See: https://chatgpt.com/share/68efc179-1a10-800f-9656-1e8731b40546 (German discussion)
2025-10-16 10:27:53 +02:00
e5d553f783 feat(wg-mtu-auto): add --prefer-wg-egress, --auto-pmtu-from-wg, and --set-wg-mtu; refine egress detection & PMTU logic
Refactor helpers; allow preferring wg* as egress when default route uses WireGuard; auto-discover peer endpoints from `wg show`/showconf as PMTU targets; add explicit `--set-wg-mtu` override with clamping; improve default-route parsing and dedup of targets.

Update unit tests to cover prefer-wg egress selection, auto-pmtu-from-wg, median/min policies, all-fail fallback, and explicit override behavior.

Conversation context: https://chatgpt.com/share/68efc179-1a10-800f-9656-1e8731b40546
2025-10-15 20:46:28 +02:00
10522d591a Add wg-mtu-auto initial implementation, documentation, and unit tests
- Added main.py: automatic WireGuard MTU calculation and PMTU probing
- Added test.py: unittests covering base, PMTU, and fallback scenarios
- Added Makefile: includes test target and install guidance
- Added README.md: usage, pkgmgr installation, and MIT license

Reference: https://chatgpt.com/share/68efc179-1a10-800f-9656-1e8731b40546
2025-10-15 19:56:43 +02:00