Repository navigation
DDNS built into mr (Cloudflare, nothing resident) and Wake-on-LAN (#5, #7) - #71
Merged
Merged
Conversation
DDNS (services.ddns): records {name, zone, token_secret, ipv4: active|<wan>|off, ipv6: off|router|::IID,
ttl}. Runs as short `mr` invocations only: WAN events through a new core OnWAN hook (5 s debounce,
flock), crond every `interval` minutes, after an apply, 立即更新 / `mr ddns update`. The provider is
called only when the address changed (plus a daily check); errors back off 1..60 min, a refused token
stops the record until it changes. Cloudflare API v4: only content (and TTL) are patched, proxied /
comments / tags kept; missing records are created unproxied; nothing is deleted. Private / CGNAT IPv4
is never published. The token never appears in logs, state, status or API answers.
WOL: `mr wol MAC|HOST [NETWORK]`, API sys.wol (POST), schedule action wol; the magic packet goes to the
LAN network's broadcast address through its bridge only (SO_BINDTODEVICE), never a WAN. 唤醒 buttons on
终端设备 and DHCP 静态分配.
Tests (httptest Cloudflare, backoff, token never leaked, packet bytes) and CI (lab crontab lines,
`mr ddns status` offline, three WOL packets between network namespaces, nothing on the WAN side).
Part of #5
Closes #7
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.
What
DDNS (
services.ddns,mr/mod_sys_ddns.go) — built intomrinstead of a resident daemon.{name, zone, token_secret, ipv4: active | <wan> | off, ipv6: off | router | "::IID", ttl}.active= the healthy WAN with the lowest metric that has a public address;router= the router's own address from the delegated prefix;::10= that suffix on the LAN prefix (a NAS). Private (RFC 1918) and CGNAT (100.64/10) IPv4 is never published — the status says why.Module.OnWAN(c, wan, event)(5 s debounce, flock), crond re-checks everyintervalminutes (default 10), an apply starts one (never fails the apply), 立即更新 /mr ddns update [--force].content(andttlif set) is patched — proxied flag, comments and tags stay; a missing record is created unproxied; records are never deleted. TLS verified against the image's CA bundle; ids validated before they go into a URL; answers capped; no redirects.mr ddns status,mr statusor API answers (tested).sys.ddns(GET),sys.ddnsupdate(POST).ddnsProviders),url:/ fixed /mac:address sources, notifications, ACME reuse (提议:内置 HTTPS 反向代理 + 自动证书(mr-edge,DNS-01) #6).Wake-on-LAN (
mr/mod_sys_wol.go, #7):mr wol MAC|HOST [NETWORK], APIsys.wol(POST), schedule actionwol HOST; 唤醒 buttons on 终端设备 and DHCP 静态分配. The magic packet goes to the LAN network's broadcast address through its bridge only (SO_BINDTODEVICE) — it cannot leave through a WAN. No config, nothing resident.Cost (arm64): DDNS ~61 KiB of code, WOL ~18 KiB; no resident RAM (crond runs while DDNS is on). Package-level patterns compile lazily (#8).
Why
The home router ran lucky (~50 MB RSS) mostly for DDNS; built-in DDNS that runs only on events and a cron tick is a step towards not needing it. WOL was a small, frequently requested feature.
Verification
tools/ci.d/sys.sh): lab crontab lines for both;mr ddns statusoffline never shows the token;mr wolbetween two network namespaces — three exact packets from the router's address arrive at the LAN broadcast :9, nothing leaves on the WAN side.tools/ci.shpasses (private and public trees, clean remote checkouts).Part of #5 · Closes #7
https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr