- Access split into Internet and Home network cards; network tiles inline, Auto-detect LAN beside them, other interfaces folded by kind - Devices reach each other: Off, Everyone or Circles (per server); circles with names, colours and members; a person's own devices always see each other while it is not off - Per-person home networks: people can be kept out of some of the server's networks (nft lan_part set, AllowedIPs follow) - Home services moved from Settings to Access, added from the devices the router sees over DHCP (ports they announce over Bonjour when umdns runs) - Who reaches what (rules summed up per access) and Check access (walks the same rules as nft and the client configuration, step by step) - Find home devices (Bonjour): umdns services published as DNS-SD records in dnsmasq; installs umdns from Access - Connections from home show the DHCP name with the address in brackets - Repaints keep the scroll position
This commit is contained in:
1 parent
82ab86848e
commit
aa8256bc60
26 files changed
+1661
-289
No files matched your search
@@ -20,6 +20,7 @@ import * as ops from 'dawnline.ops';
|
||||
import * as geo from 'dawnline.geo';
|
||||
import * as watchdog from 'dawnline.watchdog';
|
||||
import * as net from 'dawnline.net';
|
||||
import * as bonjour from 'dawnline.bonjour';
|
||||
|
||||
const TICK = 60 * 1000;
|
||||
const FLUSH_EVERY = 3600;
|
||||
@@ -151,6 +152,14 @@ function place_of(ip) {
|
||||
return pl ? join(' · ', filter([ pl.city, pl.org ], (x) => x)) : null;
|
||||
}
|
||||
|
||||
/** Connections from home: the DHCP name of the address, as it is now. */
|
||||
function named(e) {
|
||||
let h = net.event_hosts(e, net.lan_names());
|
||||
if (h)
|
||||
e.hosts = h;
|
||||
return e;
|
||||
}
|
||||
|
||||
function check_devices(m, lv, events) {
|
||||
for (let id, d in lv) {
|
||||
let dev = m.devices[id];
|
||||
@@ -169,12 +178,12 @@ function check_devices(m, lv, events) {
|
||||
delete offline_ticks[id];
|
||||
if (was != null && was != d.online) {
|
||||
if (d.online)
|
||||
push(events, { type: 'connect', person: dev.person, device: id, detail: d.endpoint, where: place_of(d.endpoint) });
|
||||
push(events, named({ type: 'connect', person: dev.person, device: id, detail: d.endpoint, where: place_of(d.endpoint) }));
|
||||
else
|
||||
push(events, { type: 'disconnect', person: dev.person, device: id });
|
||||
}
|
||||
else if (d.online && last_endpoint[id] && d.endpoint && last_endpoint[id] != d.endpoint)
|
||||
push(events, { type: 'roam', person: dev.person, device: id, detail: `${last_endpoint[id]} → ${d.endpoint}` });
|
||||
push(events, named({ type: 'roam', person: dev.person, device: id, detail: `${last_endpoint[id]} → ${d.endpoint}` }));
|
||||
last_online[id] = d.online;
|
||||
if (d.endpoint)
|
||||
last_endpoint[id] = d.endpoint;
|
||||
@@ -348,6 +357,12 @@ function tick() {
|
||||
check_wan(m);
|
||||
}
|
||||
catch (e) {}
|
||||
try {
|
||||
bonjour.sync(m);
|
||||
}
|
||||
catch (e) {
|
||||
slog('dawnline', 'error', `failed: ${e.message}`, null, 'Find home devices');
|
||||
}
|
||||
nightly_backup();
|
||||
try {
|
||||
check_geo(m);
|
||||
|
||||
@@ -28,7 +28,7 @@ const AWG_RU = 'luci-i18n-amneziawg-ru';
|
||||
// OpenWrt packages Dawnline runs on (the Updates tab groups and names them).
|
||||
// What Dawnline itself adds to OpenWrt (the rest of LuCI, ucode, rpcd and uhttpd is the
|
||||
// stock system): the home-like link, and HTTPS plus certificates for the personal portal.
|
||||
const SYS_PKGS = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme' ];
|
||||
const SYS_PKGS = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme', 'umdns' ];
|
||||
// Packages released together with each of the above, updated as a set so OpenSSL never ends up
|
||||
// half old and half new.
|
||||
const PKG_FAMILY = [
|
||||
@@ -463,6 +463,9 @@ function install_pkgs(arg) {
|
||||
// The portal's HTTPS runs in uhttpd. Restart after this job saved its state.
|
||||
let touched = [ ...names, ...have ];
|
||||
// A missing piece arrived: set up what waited for it (the portal, the home-like link).
|
||||
// Bonjour: OpenWrt's mDNS daemon starts at once; the agent publishes what it finds.
|
||||
if (index(missing, 'umdns') >= 0)
|
||||
run('/etc/init.d/umdns enable; /etc/init.d/umdns start');
|
||||
if (length(missing) && length(filter(missing, (n) => match(n, /^(openssl-util|libustream|ip-full|kmod-veth)/))))
|
||||
run('( sleep 3; /usr/bin/dawnline apply; /etc/init.d/uhttpd restart; /etc/init.d/dawnline restart ) </dev/null >/dev/null 2>&1 &');
|
||||
else if (length(filter(touched, (n) => match(n, /^(libustream|libopenssl)/))))
|
||||
|
||||
Reference in new issue
Block a user