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.
56 lines
3.1 KiB
Ucode
56 lines
3.1 KiB
Ucode
// dawnline.nft: the access table rendered for a model with two servers (one
|
|
// sending everyone like a home device, one direct) and the router read as a
|
|
// fixed context: what 0.13.0 rendered (fixtures/nft-table.txt, made by
|
|
// that version from this model).
|
|
import { readfile } from 'fs';
|
|
import * as nft from 'dawnline.nft';
|
|
|
|
const KEY = 'yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=';
|
|
const SNAP = { devices: { 'br-lan': { nets: [ '192.168.1.0/24' ], zone: 'lan', addrs: [ '192.168.1.1/24' ] }, eth1: { nets: [], zone: 'wan' } },
|
|
wan: 'eth1', lan: 'br-lan', zones: [ 'lan', 'wan' ] };
|
|
// The netns is up (its DNS address, the Home-only resolver inside it) and the LAN's DNS is the router.
|
|
const CTX = { dns_addr: '192.168.1.250', resolver: { mode: 'ns', address: '169.254.77.2', port: 53 }, lan_dns: '192.168.1.1', snap: SNAP };
|
|
const STATES = { alice: 'active', bob: 'active', carol: 'active', dave: 'active', erin: 'active' };
|
|
let golden = readfile(sourcepath(0, true) + '/fixtures/nft-table.txt');
|
|
|
|
/** Server home sends everyone like a home device, work sends everyone direct. */
|
|
function model() {
|
|
let srv = (id, ifname, subnet, lan_like, mesh) => ({ id, name: id, ifname, subnet, private_key: KEY, enabled: true, lan_like, mesh,
|
|
auto_wan: true, auto_lan: true, lan_devices: [], lan_zone: 'lan', wan_zone: 'wan', obf: {} });
|
|
let person = (id, server, access, extra) => ({ id, name: id, server, access, dns_mode: 'device', services: [], home_nets: [],
|
|
circle: '', ...(extra ?? {}) });
|
|
let dev = (person, address) => ({ person, address, disabled: false });
|
|
return {
|
|
settings: { portal_enabled: true, portal_port: 8443, portal_host: 'vpn.example.com', portal_alt: [] },
|
|
servers: { home: srv('home', 'awghome', '10.9.0.0/29', true, 'all'), work: srv('work', 'awgwork', '10.9.1.0/29', false, 'circles') },
|
|
people: {
|
|
alice: person('alice', 'home', 'both'), bob: person('bob', 'work', 'internet'),
|
|
carol: person('carol', 'home', 'lan', { dns_mode: 'home' }), dave: person('dave', 'home', 'internet'),
|
|
erin: person('erin', 'work', 'both'),
|
|
},
|
|
devices: {
|
|
a1: dev('alice', '10.9.0.2'), b1: dev('bob', '10.9.1.2'), c1: dev('carol', '10.9.0.3'),
|
|
d1: dev('dave', '10.9.0.4'), d2: dev('dave', '10.9.0.5'), e1: dev('erin', '10.9.1.3'),
|
|
},
|
|
services: {}, circles: {},
|
|
};
|
|
}
|
|
|
|
function render(m, states) {
|
|
return nft.render(m, nft.access_sets(m, null, states ?? STATES, SNAP), CTX);
|
|
}
|
|
|
|
test('render: the table as it was', () => {
|
|
ok(golden != null, 'the fixture is there');
|
|
eq(render(model()), golden, 'line for line');
|
|
let m = model();
|
|
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');
|
|
});
|