Dawnline 0.20.0
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions

- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode.
- **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V).
- **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request.
- **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds.
- **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person.
- **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router.
- **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch.
- **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away.
- **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once.
- **Undo.** An action done from a card or a request is undone from its toast.
- **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own.
- **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name.
- **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking.
- **Check access and Health know the networks behind routers.**
- **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st.
- Extra data lasts until that person's month ends; «Reset usage» starts the month anew.
- A limit is for a month or for the whole term; the admin and the portal show when it resets.
- Charts that said «this month» show the last 30 days.
- After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st.
- **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped.
- **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone.
- **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence.
- **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
This commit is contained in:
Aemeath committed 2026-11-13 09:43:50 +03:00
1 parent f8130e39a8
commit ac90575b0b
788 files changed
+139244 -41720

No files matched your search

+93
View File
@@ -0,0 +1,93 @@
package daemon
import (
"fmt"
"os"
"os/exec"
"strconv"
"strings"
"time"
backend "github.com/tickcount/luci-app-dawnline/backend"
"github.com/tickcount/luci-app-dawnline/backend/geo"
"github.com/tickcount/luci-app-dawnline/backend/journal"
"github.com/tickcount/luci-app-dawnline/backend/servicelog"
"github.com/tickcount/luci-app-dawnline/backend/store"
"github.com/tickcount/luci-app-dawnline/backend/updater"
)
// The beat is the time of the backend's last minute: the Health page calls it fine while it is fresh, and
// a beat left behind by a backend that is gone tells the next start that the last one did not end well.
const beatFile = "/agent.beat"
func readTrim(path string) string {
raw, _ := os.ReadFile(path)
return strings.Trim(string(raw), " \t\r\n\v\f")
}
// started says in the service log why this start: an update that was rolled back, a new version, a crash
// (the beat outlives a backend that died), a restart (the init script notes a stop), a boot, or a plain
// start. It also puts back the service log a reboot took from memory, and remembers the kernel an
// AmneziaWG module Dawnline did not install is for.
func started(o Options, logs *servicelog.Log) {
os.MkdirAll(o.RunDir, 0o755)
_, beat := os.Stat(o.RunDir + beatFile)
crashed := beat == nil
stopped, _ := strconv.ParseInt(readTrim(o.RunDir+"/agent.stopped"), 10, 64)
os.Remove(o.RunDir + "/agent.stopped")
was := readTrim(o.DataDir + "/version")
v := backend.Version
if was != v {
os.MkdirAll(o.DataDir, 0o700)
os.WriteFile(o.DataDir+"/version", []byte(v), 0o644)
}
// the service log lives in memory: after a reboot, what flash kept of it
if _, err := os.Stat(o.RunDir + "/service.log"); err != nil {
if raw, err := os.ReadFile(o.DataDir + "/service.log"); err == nil {
os.WriteFile(o.RunDir+"/service.log", raw, 0o600)
}
}
say := func(level, msg, detail string) {
logs.Write("dawnline", level, msg, detail, "Dawnline", servicelog.Extra{})
}
rolled := readTrim(o.RunDir + "/update-rolled-back")
os.Remove(o.RunDir + "/update-rolled-back")
uptime := 0.0
fmt.Sscan(readTrim("/proc/uptime"), &uptime)
switch {
// postupdate put this (kept) version back because the new one did not come up
case rolled != "":
say("error", fmt.Sprintf("update to %s failed its check - rolled back to %s", rolled, v),
"The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.")
case was != "" && was != v:
say("up", fmt.Sprintf("updated · %s → %s", was, v), "")
case crashed:
// why, when syslog knows: procd, the kernel (out of memory, a fault)
why, _ := exec.Command("sh", "-c", `logread -l 400 2>/dev/null | grep -iE "kernel:.*(out of memory|killed process|oom-kill|segfault)|procd:.*dawnline|dawnlined" | tail -n 6`).Output()
say("repair", "stopped unexpectedly - started again", strings.Trim(string(why), " \t\r\n\v\f"))
case stopped != 0 && time.Now().Unix()-stopped < 300:
say("info", "restarted · version "+v, "")
case uptime < 600:
say("info", "started with the router · version "+v, "")
default:
say("info", "started · version "+v, "")
}
updater.Adopt(o.DataDir)
beatNow(o)
}
func beatNow(o Options) {
os.WriteFile(o.RunDir+beatFile, []byte(strconv.FormatInt(time.Now().Unix(), 10)), 0o644)
}
// ended is a clean stop: what lives in memory goes to flash (the activity log, the service log, the places
// found), and the beat goes, so the next start is not taken for a crash. The counters are the watcher's.
func ended(o Options, logs *servicelog.Log) {
now := time.Now().Unix()
if _, m, err := (store.Store{Config: o.Config, RunDir: o.RunDir}).Read(); err == nil {
journal.Log{Run: o.RunDir, Data: o.DataDir}.Persist(journal.PolicyOf(m.Settings.Retention), now)
}
logs.Trim(o.DataDir, true)
geo.Store{Run: o.RunDir, Data: o.DataDir}.Flush()
os.Remove(o.RunDir + beatFile)
}