Dawnline 0.18.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
- Add V2RayTun to a device's set-up on Android: its awg:// link as a code and to copy, in the portal and in the admin (phones, tablets and other devices), with the server's IP, which its Android app needs; not with the Maximum disguise. Its Windows app is ready but stays off until it gives the tunnel the server's DNS. - Portal: show V2RayTun's Telegram channel beside Google Play. - Make WireGuard part of AmneziaWG's choice when the disguise is off: the same file and code, both apps named in the steps, WireGuard's store a tap away; a router still picks its package. - Portal: Reconnect asks again what the device is and about LAN Bypass, and LAN Bypass switches from a device's ⋯ menu, in a group of its own between the copy actions and Rename, Reconnect, Remove (the keys stay; the device takes its updated configuration). - Turn LAN Bypass on by default for new devices, in the portal and the admin. - Portal: an app's name too long for the picker fades at its edge and glides to its end on hover or tap; two store buttons stack where they do not fit side by side; the month chart's "Today" stays inside its axis. - Write to the router's system log by level (Settings → Logs & history → System log: errors, warnings, normal, verbose): the service starting and stopping, every apply with its time, network, firewall, nftables and peer changes, changed settings and portal errors, in English whatever the admin's language, with keys masked. - Activity: say what a device's change on the portal was (LAN Bypass on or off, its type). - Demo: build again after a force-pushed main instead of failing on the commit that is gone.
This commit is contained in:
1 parent
18e3013047
commit
f8130e39a8
65 files changed
+2066
-338
No files matched your search
@@ -154,6 +154,18 @@ function recorder() {
|
||||
return { w, c: { set: (cfg, s, k, v) => { w[`${s}.${k}`] = v; }, delete: (cfg, s, k) => { w[`${s}.${k}`] = null; } } };
|
||||
}
|
||||
|
||||
test('set_device_kind', () => {
|
||||
let mm = { devices: { d: { id: 'd', kind: 'phone' } } };
|
||||
let r = recorder();
|
||||
eq(core.set_device_kind(r.c, mm, 'd', 'tablet'), true, 'changed');
|
||||
eq([ r.w, mm.devices.d.kind ], [ { 'd.kind': 'tablet' }, 'tablet' ], 'written, and the model follows');
|
||||
r = recorder();
|
||||
eq(core.set_device_kind(r.c, mm, 'd', 'tablet'), false, 'the same kind changes nothing');
|
||||
eq(r.w, {}, 'nothing written');
|
||||
throws(() => core.set_device_kind(r.c, mm, 'd', 'toaster'), /^Unknown device type\.$/, 'not a kind');
|
||||
throws(() => core.set_device_kind(r.c, mm, 'x', 'phone'), /^Unknown device\.$/, 'unknown device');
|
||||
});
|
||||
|
||||
test('set_device_link', () => {
|
||||
let mm = { devices: { d: { id: 'd', mtu: 0, keepalive: null, lan_bypass: false } } };
|
||||
let r = recorder();
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
// sync's nft and awg steps fail harmlessly in the container. /etc/config/dawnline
|
||||
// and the issued and reconnect marks are put back after.
|
||||
import { readfile, writefile, unlink } from 'fs';
|
||||
import { DATA_DIR, ensure_dir } from 'dawnline.util';
|
||||
import { DATA_DIR, RUN_DIR, ensure_dir } from 'dawnline.util';
|
||||
import * as core from 'dawnline.core';
|
||||
import * as awg from 'dawnline.awg';
|
||||
import * as people from 'dawnline.rpc.people';
|
||||
import * as devices from 'dawnline.devices';
|
||||
|
||||
const CONFIG = '/etc/config/dawnline';
|
||||
const ISSUED = `${DATA_DIR}/issued.json`;
|
||||
const RECONNECT = `${DATA_DIR}/reconnect.json`;
|
||||
const EVENTS = `${RUN_DIR}/events.json`;
|
||||
|
||||
// fn(), then the files as they were, whatever fn did.
|
||||
function kept(paths, fn) {
|
||||
@@ -65,3 +67,20 @@ test('device_rotate: New keys set the device up again', () => {
|
||||
});
|
||||
eq(core.load().devices.alice_phone.private_key, '', 'the fixture is back');
|
||||
});
|
||||
|
||||
test('portal: Reconnect changes what it is and LAN Bypass with the keys; LAN Bypass alone keeps them', () => {
|
||||
ensure_dir(RUN_DIR);
|
||||
kept([ CONFIG, ISSUED, RECONNECT, EVENTS ], () => {
|
||||
let mine = { by: 'portal', person: 'alice' };
|
||||
devices.reconnect('alice_phone', { ...mine, kind: 'tablet', lan_bypass: true });
|
||||
let d = core.load().devices.alice_phone;
|
||||
eq([ d.kind, d.lan_bypass ], [ 'tablet', true ], 'changed in the same write as the keys');
|
||||
let keys = d.public_key;
|
||||
devices.update('alice_phone', { lan_bypass: false }, mine);
|
||||
d = core.load().devices.alice_phone;
|
||||
eq([ d.lan_bypass, d.public_key ], [ false, keys ], 'LAN Bypass off, the keys as they were');
|
||||
throws(() => devices.update('alice_phone', { mtu: '1400' }, mine), /^Only the admin can change how a device connects\.$/, "the MTU stays the admin's");
|
||||
throws(() => devices.reconnect('alice_phone', { ...mine, kind: 'toaster' }), /^Unknown device type\.$/, 'not a kind');
|
||||
throws(() => devices.update('alice_phone', { lan_bypass: true }, { by: 'portal', person: 'bob' }), /^Device not found\.$/, "another person's device");
|
||||
});
|
||||
});
|
||||
@@ -180,3 +180,15 @@ test('add_event_merged: per device', () => {
|
||||
eq(live.category_of('device_recovered'), 'problems', 'and so is its end');
|
||||
had == null ? unlink(path) : writefile(path, had);
|
||||
});
|
||||
|
||||
test('event_level and event_line: the system\'s events in syslog', () => {
|
||||
eq(live.event_level({ type: 'connect' }), null, 'a connection stays out of syslog');
|
||||
eq(live.event_level({ type: 'roam' }), null, 'so does a device moving networks');
|
||||
eq(live.event_level({ type: 'device_failing' }), null, "and a device's link trouble");
|
||||
eq(live.event_level({ type: 'device_changed' }), 'info', 'people and devices are info');
|
||||
eq(live.event_level({ type: 'server_down' }), 'warn', 'a problem is warn');
|
||||
eq(live.event_level({ type: 'server_up' }), 'info', 'its end is info');
|
||||
eq(live.event_line({ type: 'device_changed', pname: 'Myata', dname: 'Phone', detail: 'kind=phone, lan_bypass=on', by: 'portal' }),
|
||||
'Myata · Phone device changed · kind=phone, lan_bypass=on (portal)', 'names, what, detail, by whom');
|
||||
eq(live.event_line({ type: 'paused', person: 'p1' }), 'p1 paused', 'the id where there is no name');
|
||||
});
|
||||
@@ -47,3 +47,9 @@ test('render: the table as it was', () => {
|
||||
m.devices.b1.lan_bypass = true;
|
||||
eq(render(m), golden, 'a device that keeps its own local network out of the tunnel changes nothing here');
|
||||
});
|
||||
|
||||
test('shape: chains, sets and rules of a table script', () => {
|
||||
let t = 'table inet dawnline {\n\tset inet_ok {\n\t\ttype ipv4_addr\n\t}\n\tchain forward {\n\t\ttype filter hook forward priority 0; policy accept;\n\t\tiifname "dawn0" ip saddr @inet_ok accept\n\t\t# a note\n\t\tiifname "dawn0" drop\n\t}\n}\n';
|
||||
eq(nft.shape(t), { chains: 1, sets: 1, rules: 2 }, 'the hook line, the policy and a comment are no rules');
|
||||
eq(nft.shape(''), { chains: 0, sets: 0, rules: 0 }, 'nothing');
|
||||
});
|
||||
@@ -26,6 +26,8 @@ test('validate: int', () => {
|
||||
test('validate: enum', () => {
|
||||
eq(schema.validate('geo_provider', 'ipapi.co'), 'ipapi.co', 'known');
|
||||
throws(() => schema.validate('geo_provider', 'maxmind'), /Unknown location service/, 'unknown');
|
||||
eq(schema.validate('log_level', 'debug'), 'debug', 'a syslog level');
|
||||
throws(() => schema.validate('log_level', 'trace'), /system log level/, 'not a syslog level');
|
||||
eq(schema.validate('update_interval', '7d'), '7d', 'interval from dawnline.updates');
|
||||
throws(() => schema.validate('update_interval', '2d'), /6h, 12h, 1d or 7d/, 'unknown interval');
|
||||
});
|
||||
|
||||
@@ -318,3 +318,18 @@ test('host_label, tunnel_name, slugify: dashes trimmed without a regex', () => {
|
||||
}
|
||||
same(null);
|
||||
});
|
||||
|
||||
test('syslog_line', () => {
|
||||
eq(util.syslog_line('warn', 'awg', 'Home stopped unexpectedly'), '[warn] [awg] Home stopped unexpectedly', 'level, source, words');
|
||||
eq(util.syslog_line('error', 'apply', 'failed:\n no table\tthere'), '[error] [apply] failed: no table there', 'one line');
|
||||
eq(util.syslog_line('loud', null, 'x'), '[info] [dawnline] x', 'an unknown level is info, no source is dawnline');
|
||||
eq(length(util.syslog_line('info', 'x', replace(sprintf('%1500s', ''), ' ', 'y'))), 1000, 'at most 1000 characters');
|
||||
});
|
||||
|
||||
test('opts_text: options in a log line, keys masked', () => {
|
||||
eq(util.opts_text({ listen_port: 51820, addresses: [ '10.8.0.1/24' ], private_key: 'abc=', mtu: null }),
|
||||
'listen_port=51820, addresses=10.8.0.1/24, private_key=***, mtu=-', 'values, lists, a secret, nothing');
|
||||
eq(util.opts_text({ preshared_key: 'x', awg_header_protection_key: 'y', public_key: 'z' }),
|
||||
'preshared_key=***, awg_header_protection_key=***, public_key=z', 'a public key is no secret');
|
||||
eq(util.opts_text(null), '', 'none');
|
||||
});
|
||||
Reference in new issue
Block a user