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

+157
View File
@@ -0,0 +1,157 @@
// Package ipnet is IPv4 networks as Dawnline's settings and configurations write them, read exactly as
// the ucode backend reads them (dawnline.util ip2int, cidr_any, parse_cidr; dawnline.net collapse): the
// configurations devices hold are made of these, and a device must not be told to import again because
// two backends disagree on a prefix.
package ipnet
import (
"fmt"
"net/netip"
"regexp"
"sort"
"strconv"
)
var (
ipv4 = regexp.MustCompile(`^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$`)
cidr = regexp.MustCompile(`^([0-9.]+)(/([0-9]+))?$`)
)
// IP is "a.b.c.d" as a number; ok is false for anything else (an octet over 255 too).
func IP(s string) (uint32, bool) {
m := ipv4.FindStringSubmatch(s)
if m == nil {
return 0, false
}
var n uint32
for _, part := range m[1:] {
o, err := strconv.ParseUint(part, 10, 32)
if err != nil || o > 255 {
return 0, false
}
n = n*256 + uint32(o)
}
return n, true
}
// String is a number as "a.b.c.d".
func String(n uint32) string {
return fmt.Sprintf("%d.%d.%d.%d", n>>24&255, n>>16&255, n>>8&255, n&255)
}
// Net is an IPv4 network.
type Net struct {
// Base is its first address, Prefix its length, IP the address it was written with.
Base uint32
Prefix int
IP uint32
}
// Size is how many addresses it holds.
func (n Net) Size() uint64 { return 1 << (32 - n.Prefix) }
// Holds tells whether an address is in it.
func (n Net) Holds(ip uint32) bool {
return uint64(ip) >= uint64(n.Base) && uint64(ip) < uint64(n.Base)+n.Size()
}
// Overlaps tells whether two networks share an address: one holds the other, or they are the same.
func (n Net) Overlaps(o Net) bool { return n.Holds(o.Base) || o.Holds(n.Base) }
func (n Net) String() string { return fmt.Sprintf("%s/%d", String(n.Base), n.Prefix) }
// Any reads "a.b.c.d[/len]" with any prefix 0 to 32 (a bare address is a /32).
func Any(s string) (Net, bool) {
m := cidr.FindStringSubmatch(s)
if m == nil {
return Net{}, false
}
ip, ok := IP(m[1])
if !ok {
return Net{}, false
}
prefix := 32
if m[2] != "" {
p, err := strconv.ParseUint(m[3], 10, 31)
if err != nil || p > 32 {
return Net{}, false
}
prefix = int(p)
}
size := uint64(1) << (32 - prefix)
return Net{Base: uint32(uint64(ip) - uint64(ip)%size), Prefix: prefix, IP: ip}, true
}
// Subnet reads "a.b.c.d/len" as a tunnel's or a home's subnet may be: a prefix 8 to 30, written out.
func Subnet(s string) (Net, bool) {
m := cidr.FindStringSubmatch(s)
if m == nil || m[2] == "" {
return Net{}, false
}
n, ok := Any(s)
if !ok || n.Prefix < 8 || n.Prefix > 30 {
return Net{}, false
}
return n, true
}
// First is the first host of a subnet: the router's address in a tunnel's.
func (n Net) First() uint32 { return n.Base + 1 }
// Collapse drops the networks another of the list already covers, and answers the rest in address order.
// What is no network (or the default route) is left out.
func Collapse(list []string) []string {
seen := map[string]bool{}
var nets []Net
for _, s := range list {
if seen[s] {
continue
}
seen[s] = true
if n, ok := Any(s); ok && n.Prefix >= 1 {
nets = append(nets, n)
}
}
sort.SliceStable(nets, func(i, j int) bool {
if nets[i].Prefix != nets[j].Prefix {
return nets[i].Prefix < nets[j].Prefix
}
return nets[i].Base < nets[j].Base
})
var keep []Net
for _, n := range nets {
inside := false
for _, k := range keep {
if k.Holds(n.Base) {
inside = true
break
}
}
if !inside {
keep = append(keep, n)
}
}
sort.SliceStable(keep, func(i, j int) bool { return keep[i].Base < keep[j].Base })
out := make([]string, 0, len(keep))
for _, n := range keep {
out = append(out, n.String())
}
return out
}
var hexColons = regexp.MustCompile(`^[0-9A-Fa-f:.]+$`)
// Private6 tells whether an IPv6 address is one the tunnel's "everything but the local network" list
// leaves out: in fc00::/7, fe80::/10 or ff00::/8. False for anything that is no IPv6 address.
func Private6(s string) bool {
if len(s) < 2 || len(s) > 45 || !hexColons.MatchString(s) {
return false
}
a, err := netip.ParseAddr(s)
if err != nil || !a.Is6() {
return false
}
b := a.As16()
g := uint16(b[0])<<8 | uint16(b[1])
return g&0xfe00 == 0xfc00 || g&0xffc0 == 0xfe80 || g&0xff00 == 0xff00
}