perf: skip netfilter hook work when WAN IP is unchanged - #115
Open
dmiales wants to merge 4 commits into
Open
Conversation
dmiales
force-pushed
the
contrib/06-wan-skip
branch
2 times, most recently
from
July 29, 2026 00:23
18c5b90 to
8d138c4
Compare
Unpack XKeen into a temp dir, verify, then move into place so an interrupted update never leaves a half-written install. Add a gzip -t pre-check for the mihomo archive with backup restore, and a minimum-size guard for core downloads to reject truncated/stub files.
Enable geo-auto-update in the generated mihomo config (mihomo manages its own GeoSite/GeoIP/ASN, XKeen's xray dat files are unused for it). Make 'xkeen -ug' aware of the active core: for mihomo it explains geo-auto-update and only reapplies GeoIPSET instead of touching unused xray dat files.
Make the mihomo Go GC soft memory limit configurable via xkeen.json (.xkeen.gomemlimit_percent / .xkeen.gomemlimit_mb) instead of a hardcoded value. Default stays at 50% of RAM (unchanged behaviour); an explicit MiB value has no default. An external GOMEMLIMIT still wins.
On short DHCP leases NDM invokes netfilter.d every renew, usually with the same WAN IP. Remember the last WAN IP and, if it hasn't changed and the chains are intact, skip the redundant route/rule work.
dmiales
force-pushed
the
contrib/06-wan-skip
branch
from
July 29, 2026 00:29
8d138c4 to
b6241e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что и зачем
На коротких DHCP-lease NDM вызывает
netfilter.dна каждый renew, обычно с тем же WAN IP. Запоминаем последний WAN IP и, если он не сменился и цепочки целы, пропускаем лишнюю работу по маршрутам/правилам.Как проверял
На роутере Keenetic (mihomo/TProxy) с частыми renew: цепочки остаются целыми, лишняя работа не выполняется;
sh -n.Часть 6/8 — после части 5.
Часть стека харденинга. Полный порядок влития: 1 inject_var → 2 RCI/dry-run → 3 установка → 4 mihomo-geo → 5 GOMEMLIMIT → 6 WAN-skip → 7 hook-renew → 8 serialize. Ветка включает коммиты предыдущих частей — diff очистится после их мержа.