Dawnline 0.7.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 / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
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 / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- Balanced, a new disguise for AmneziaWG 2.0 apps (AmneziaVPN 4.8.12 and newer): junk packets, padded cookie and data packets and DNS-shaped signature packets, for networks that learned to spot 1.0-style junk; offered when both the tools and the kernel module are 2.0 or newer - The junk count and sizes in a device's configuration are the device's own (shifted a little, deterministically), so two phones of one family do not share one profile; they never require importing again - Components remembers which AmneziaWG build was installed on which kernel; after a firmware upgrade Health says the build was for the old one and offers the build for the new firmware. A SNAPSHOT firmware is told there are no builds for it - Location lookups moved off the agent's 1-second watcher to its minute tick, a few per minute within a time budget; the cache lives in tmpfs and goes to flash hourly, and addresses still shown on the map are never pushed out of it (and looked up again) - The map library from the CDN is checked against its expected hash before it runs inside the LuCI page - The activity log is copied to flash only when something was logged; the person page and the device drawer fetch only that person's events - Admin UI: live updates survive the theme's in-page navigation, pollers stop with their page and sleep while the tab is hidden, the map is freed when leaving the Overview, a router that stops answering is said once (and when it is back), and an update of Dawnline under an open page asks for a reload - Watchdog: no repairs while an update runs; a target that keeps failing keeps its back-off (repairs are forgotten after ten good minutes, not one); the LuCI link is reloaded or restarted three times at most, not every hour for good; the one-click "ifup" fix accepts only Dawnline's own tunnels - Health warns when the router's flash is nearly full (settings would stop saving); the portal runs two processes instead of four on routers with little memory - "Remove their devices" at an end date is never done on a clock that has not been set yet
This commit is contained in:
1 parent
31a2065f05
commit
fd9543ce68
30 files changed
+411
-117
No files matched your search
@@ -405,7 +405,7 @@ export interface ServiceLog {
|
||||
export type Health = { checks: HealthCheck[] } & ServiceLog;
|
||||
|
||||
export const api = {
|
||||
rev: call<{ rev: number }>('rev'),
|
||||
rev: call<{ rev: number; version?: string }>('rev'),
|
||||
personUpdate,
|
||||
settingsGet: call<SettingsData>('settings_get'),
|
||||
portalInfo: call<PortalInfo>('portal_info'),
|
||||
@@ -413,7 +413,8 @@ export const api = {
|
||||
serviceSet: call<{ id: string }>('service_set', ['id', 'name', 'address', 'ports']),
|
||||
serviceDelete: call<unknown>('service_delete', ['id']),
|
||||
geoClear: call<unknown>('geo_clear'),
|
||||
events: call<{ events: LogEvent[]; total: number; policy: LogsInfo['policy'] }>('events', ['limit']),
|
||||
/** The newest `limit` events; a person's only, or only those after `since` (a ts), when given. */
|
||||
events: call<{ events: LogEvent[]; total: number; policy: LogsInfo['policy'] }>('events', ['limit', 'person', 'since']),
|
||||
logsClear,
|
||||
interfaces: call<InterfacesData>('interfaces', ['id']),
|
||||
serverInterfaces: call<InterfacesData>('server_interfaces', [
|
||||
|
||||
@@ -243,7 +243,7 @@ async function applyDisguise(ctx: CoreCtx, srv: Server, m: Method, same: boolean
|
||||
const devices = people.reduce((n, p) => n + p.devices.length, 0);
|
||||
const ok = await confirmDialog(
|
||||
same ? 'Generate new disguise values?' : `Switch to ${info.title}?`,
|
||||
`${devices} AmneziaWG device${devices === 1 ? '' : 's'} stop connecting until they import their configuration again (from their personal link or from you).${m === 'max' ? ' They need an app with AmneziaWG 3.1.' : ''}`,
|
||||
`${devices} AmneziaWG device${devices === 1 ? '' : 's'} stop connecting until they import their configuration again (from their personal link or from you).${m === 'max' ? ' They need an app with AmneziaWG 3.1.' : m === 'balanced' ? ' They need an app with AmneziaWG 2.0 or newer.' : ''}`,
|
||||
same ? 'Generate and apply' : 'Switch and apply',
|
||||
true,
|
||||
);
|
||||
@@ -351,7 +351,7 @@ function overviewTile(srv: Server): HTMLElement {
|
||||
const pad = ['s1', 's2', 's3', 's4'].filter((k) => +o[k]).map((k) => `${k.toUpperCase()} ${o[k]}`);
|
||||
if (pad.length) chips.push(pad.slice(0, 2).join(' · ') + (pad.length > 2 ? ` +${pad.length - 2}` : ''));
|
||||
if (['h1', 'h2', 'h3', 'h4'].some((k) => o[k] && o[k] !== String(['h1', 'h2', 'h3', 'h4'].indexOf(k) + 1))) chips.push('H1–H4 random');
|
||||
if (o.i1) chips.push(o.i1.includes('0x8580') ? 'DNS-like first packet' : 'Signature packets');
|
||||
if (o.i1) chips.push(/0x(8580|0100)0001/.test(o.i1) ? 'DNS-like first packets' : 'Signature packets');
|
||||
if (o.header_protection_key) chips.push('Encrypted headers');
|
||||
if (!chips.length) chips.push(m?.id === 'off' ? 'Plain WireGuard' : 'No values yet');
|
||||
return E('div', { class: 'dl-bento-tile dl-disg' }, [
|
||||
|
||||
@@ -137,7 +137,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) {
|
||||
const loadLog = async (force = false) => {
|
||||
const own = o.events?.();
|
||||
if (own && !force) return showLog(own);
|
||||
const ev = await api.events(5000).catch(() => null);
|
||||
const ev = await api.events(2000, person.id).catch(() => null);
|
||||
if (ev) showLog(ev.events);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { AwgCaps } from '../shared/types';
|
||||
import { E } from './e';
|
||||
import { icon } from '../shared/icons';
|
||||
|
||||
export type Method = 'standard' | 'strong' | 'max' | 'off';
|
||||
export type Method = 'standard' | 'strong' | 'balanced' | 'max' | 'off';
|
||||
/** The router features a method may need (the boolean ones of AwgCaps). */
|
||||
export type AwgNeed = 'v2' | 'v3';
|
||||
|
||||
@@ -55,6 +55,17 @@ export const METHODS: MethodInfo[] = [
|
||||
apps: 'Every AmneziaWG and AmneziaVPN app',
|
||||
short: 'Any AmneziaWG app',
|
||||
},
|
||||
{
|
||||
id: 'balanced',
|
||||
title: 'Balanced',
|
||||
ic: 'shieldplus',
|
||||
stealth: 3,
|
||||
speed: 3,
|
||||
needs: 'v2',
|
||||
text: 'AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk.',
|
||||
apps: 'AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps',
|
||||
short: 'AmneziaWG 2.0+ apps',
|
||||
},
|
||||
{
|
||||
id: 'max',
|
||||
title: 'Maximum',
|
||||
@@ -71,7 +82,7 @@ export const METHODS: MethodInfo[] = [
|
||||
export const methodInfo = (id: string): MethodInfo | undefined => METHODS.find((x) => x.id === id);
|
||||
|
||||
const NEEDS: Record<AwgNeed, string> = {
|
||||
v2: 'Needs AmneziaWG 1.5 or newer on the router.',
|
||||
v2: 'Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on).',
|
||||
v3: 'Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1).',
|
||||
};
|
||||
|
||||
|
||||
+36
-11
@@ -13,6 +13,15 @@ import { onNavigate } from './ui/nav';
|
||||
|
||||
// mapcn requires maplibre-gl ^6 (the globe projection came with 5): an ES module, its worker beside it.
|
||||
const MAPLIBRE = 'https://unpkg.com/maplibre-gl@6.14.0/dist';
|
||||
// What those files must be (sha384): code from a CDN runs inside the LuCI
|
||||
// page, where it could use the admin's session. A modulepreload with an
|
||||
// integrity carries the check into the import(); the stylesheet has its own.
|
||||
// The worker (loaded by the library) runs in its own context without the page
|
||||
// or the session, so it goes unchecked.
|
||||
const MAPLIBRE_SRI = {
|
||||
module: 'sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk',
|
||||
css: 'sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04',
|
||||
};
|
||||
const STYLE_DARK = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';
|
||||
const STYLE_LIGHT = 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json';
|
||||
|
||||
@@ -29,19 +38,35 @@ let loading: Promise<any> | null = null;
|
||||
* leaves it alone), with the worker URL set as mapcn does.
|
||||
*/
|
||||
function loadMapLibre(host: HTMLElement): Promise<any> {
|
||||
host.appendChild(E('link', { rel: 'stylesheet', href: `${MAPLIBRE}/maplibre-gl.css` }));
|
||||
host.appendChild(
|
||||
E('link', { rel: 'stylesheet', href: `${MAPLIBRE}/maplibre-gl.css`, integrity: MAPLIBRE_SRI.css, crossorigin: 'anonymous' }),
|
||||
);
|
||||
if (loading) return loading;
|
||||
const url = `${MAPLIBRE}/maplibre-gl.mjs`;
|
||||
loading = import(/* @vite-ignore */ url).then(
|
||||
(gl) => {
|
||||
if (!gl.getWorkerUrl()) gl.setWorkerUrl(`${MAPLIBRE}/maplibre-gl-worker.mjs`);
|
||||
return gl;
|
||||
},
|
||||
() => {
|
||||
loading = null;
|
||||
throw new Error('Could not load the map library (no internet access from this browser?)');
|
||||
},
|
||||
);
|
||||
// The preload fetches and checks the module; the module map keeps the
|
||||
// result, so the import() below gets the checked copy or fails with it.
|
||||
const preload = new Promise<void>((resolve, reject) => {
|
||||
const link = E('link', { rel: 'modulepreload', href: url, integrity: MAPLIBRE_SRI.module, crossorigin: 'anonymous' });
|
||||
link.addEventListener('load', () => resolve());
|
||||
link.addEventListener('error', () => reject(new Error('integrity')));
|
||||
document.head.appendChild(link);
|
||||
});
|
||||
loading = preload
|
||||
.then(() => import(/* @vite-ignore */ url))
|
||||
.then(
|
||||
(gl) => {
|
||||
if (!gl.getWorkerUrl()) gl.setWorkerUrl(`${MAPLIBRE}/maplibre-gl-worker.mjs`);
|
||||
return gl;
|
||||
},
|
||||
(e: Error) => {
|
||||
loading = null;
|
||||
throw new Error(
|
||||
e?.message === 'integrity'
|
||||
? 'The map library from the CDN is not the expected file: not loading it.'
|
||||
: 'Could not load the map library (no internet access from this browser?)',
|
||||
);
|
||||
},
|
||||
);
|
||||
return loading;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import { repaint } from '../state/poller';
|
||||
import { daysTile, speedTile } from '../widgets/tiles';
|
||||
import { coreOf } from '../cores';
|
||||
import { healthNotices, runFix } from '../widgets/health';
|
||||
import { onNavigate } from '../ui/nav';
|
||||
|
||||
interface Attention {
|
||||
tone: string;
|
||||
@@ -156,6 +157,7 @@ export class ServerOverview {
|
||||
'.',
|
||||
]),
|
||||
]);
|
||||
this.map?.destroy();
|
||||
this.map = new ConnectionMap(
|
||||
{
|
||||
openPerson: (id) => (location.href = personUrl(id)),
|
||||
@@ -163,6 +165,13 @@ export class ServerOverview {
|
||||
},
|
||||
this.range,
|
||||
);
|
||||
// A WebGL map outlives the page's DOM unless it is told: free it when
|
||||
// Outline navigates away (the page object itself may be reused).
|
||||
const offNav = onNavigate(() => {
|
||||
offNav();
|
||||
this.map?.destroy();
|
||||
this.map = null;
|
||||
});
|
||||
const legend = E('div', { class: 'dl-map-legend' }, [
|
||||
E('span', {}, [E('i', { class: 'line live' }), 'Live tunnel']),
|
||||
E('span', {}, [E('i', { class: 'line' }), 'Seen recently']),
|
||||
|
||||
@@ -48,7 +48,7 @@ export class PersonPage {
|
||||
async fetch(full: boolean): Promise<Loaded> {
|
||||
const [st, ev, use] = await Promise.all([
|
||||
api.status(30),
|
||||
full ? api.events(5000).catch(() => null) : Promise.resolve(null),
|
||||
full ? api.events(2000, this.id).catch(() => null) : Promise.resolve(null),
|
||||
full ? api.personUsage(this.id, 30).catch(() => null) : Promise.resolve(null),
|
||||
]);
|
||||
return { st, ev: ev?.events ?? null, use };
|
||||
|
||||
@@ -87,7 +87,9 @@ export class ServerPage {
|
||||
dom.content(this.root, [this.tabsEl, this.headEl, this.secEl, this.bodyEl]);
|
||||
this.paint();
|
||||
// Live numbers on the Overview; settings forms are left alone while open,
|
||||
// and so is anything that has the keyboard focus.
|
||||
// and so is anything that has the keyboard focus. A page object survives
|
||||
// Outline's navigation: the previous visit's poller must not pile up.
|
||||
this.poller?.stop();
|
||||
this.poller = createPoller({
|
||||
fetch: () => api.status(31),
|
||||
every: 30,
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
// router within seconds without fetching the full status that often.
|
||||
|
||||
import { api } from '../api';
|
||||
import { notify } from '../ui/toast';
|
||||
|
||||
const EVERY = 2;
|
||||
|
||||
const listeners = new Set<() => void>();
|
||||
let last: number | null = null;
|
||||
let started = false;
|
||||
let version: string | null = null;
|
||||
|
||||
async function tick(): Promise<void> {
|
||||
if (document.visibilityState !== 'visible' || !listeners.size) return;
|
||||
@@ -17,15 +18,27 @@ async function tick(): Promise<void> {
|
||||
if (!r) return;
|
||||
const moved = last != null && r.rev !== last;
|
||||
last = r.rev;
|
||||
// The router's Dawnline changed under this page (an update): its bundle
|
||||
// and RPC shapes may not match any more.
|
||||
if (r.version) {
|
||||
if (version && r.version !== version) {
|
||||
notify(`Dawnline was updated to ${r.version}: reload the page.`, 'warning', 15000);
|
||||
version = null;
|
||||
} else version ??= r.version;
|
||||
}
|
||||
if (moved) listeners.forEach((f) => f());
|
||||
}
|
||||
|
||||
/** Call `f` whenever the revision moves; returns the unsubscribe. */
|
||||
/**
|
||||
* Call `f` whenever the revision moves; returns the unsubscribe. The tick is
|
||||
* (re)added on every subscription: Outline's same-document router flushes the
|
||||
* poll queue on navigation, and poll.add is a no-op while it is queued.
|
||||
*/
|
||||
export function onLiveChange(f: () => void): () => void {
|
||||
listeners.add(f);
|
||||
if (!started) {
|
||||
started = true;
|
||||
poll.add(tick, EVERY);
|
||||
}
|
||||
return () => listeners.delete(f);
|
||||
poll.add(tick, EVERY);
|
||||
return () => {
|
||||
listeners.delete(f);
|
||||
if (!listeners.size) poll.remove(tick);
|
||||
};
|
||||
}
|
||||
@@ -3,6 +3,11 @@
|
||||
// focused button), so a background refresh never takes it away.
|
||||
|
||||
import { onLiveChange } from './live';
|
||||
import { onNavigate } from '../ui/nav';
|
||||
import { notify } from '../ui/toast';
|
||||
|
||||
/** Failed ticks in a row before the page says the router is out of reach. */
|
||||
const LOST_AFTER = 3;
|
||||
|
||||
/**
|
||||
* Request tickets: an answer is shown only if nothing newer was shown before
|
||||
@@ -46,27 +51,41 @@ export interface Poller<T> {
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A poller lives with its page: it stops itself when Outline navigates away
|
||||
* (its DOM is gone, its ticks would keep asking the router), skips ticks while
|
||||
* the tab is hidden, and says so once when the router stops answering.
|
||||
*/
|
||||
export function createPoller<T>(o: PollerOptions<T>): Poller<T> {
|
||||
const seq = new Sequence();
|
||||
let failed = 0;
|
||||
const load = async (quiet: boolean, live: boolean): Promise<T | null> => {
|
||||
const t = seq.next();
|
||||
const d = await o.fetch(live).catch(() => null);
|
||||
let d: T | null = null;
|
||||
try {
|
||||
d = await o.fetch(live);
|
||||
if (failed >= LOST_AFTER) notify('The router answers again.', 'success', 3000);
|
||||
failed = 0;
|
||||
} catch {
|
||||
if (++failed === LOST_AFTER) notify('The router is not answering: what you see may be out of date.', 'warning', 8000);
|
||||
return null;
|
||||
}
|
||||
if (d == null || !seq.take(t)) return null;
|
||||
o.apply(d, quiet);
|
||||
return d;
|
||||
};
|
||||
const refresh = (quiet = false) => load(quiet, false);
|
||||
const tick = () => ((o.active?.() ?? true) ? load(true, false) : Promise.resolve(null));
|
||||
const visible = () => document.visibilityState === 'visible';
|
||||
const tick = () => (visible() && (o.active?.() ?? true) ? load(true, false) : Promise.resolve(null));
|
||||
poll.add(tick, o.every);
|
||||
const off = o.live ? onLiveChange(() => void ((o.active?.() ?? true) && load(true, true))) : null;
|
||||
return {
|
||||
refresh,
|
||||
claim: () => seq.claim(),
|
||||
stop: () => {
|
||||
poll.remove(tick);
|
||||
off?.();
|
||||
},
|
||||
const off = o.live ? onLiveChange(() => void (visible() && (o.active?.() ?? true) && load(true, true))) : null;
|
||||
const stop = () => {
|
||||
poll.remove(tick);
|
||||
off?.();
|
||||
offNav();
|
||||
};
|
||||
const offNav = onNavigate(stop);
|
||||
return { refresh, claim: () => seq.claim(), stop };
|
||||
}
|
||||
|
||||
/** The keyboard focus (or an open native picker's input) is inside `el`. */
|
||||
|
||||
@@ -50,6 +50,7 @@ function checkIcon(id: string): string {
|
||||
if (/^(ep_|home_|resolver)/.test(id)) return 'globe';
|
||||
if (id === 'clock') return 'clock';
|
||||
if (id === 'agent') return 'activity';
|
||||
if (id === 'flash') return 'download';
|
||||
if (id === 'nft') return 'lock';
|
||||
if (id === 'data') return 'users';
|
||||
return 'alert';
|
||||
|
||||
Reference in new issue
Block a user