Build packages / Version (push) Waiting to run
- Where people connect from is a globe map now: live arcs from each
person to the server, grey ones for the last 24 h, 7 or 30 days, avatars
instead of dots, the server's own marker, and a light map in light mode;
it zooms to fit the people shown and follows them as they come and go
- Markers that overlap move apart with a pointer to their spot; people
next to the server fold into a count on it; a click zooms in and opens a
floating card (never clipped by the map), closing flies back
- The person page maps where they connected from, older places fading;
the device panel lists its places in order, and connections from the LAN
or through the router's own address stay off the maps ("LAN" in grey)
- Setup and new servers check the UDP port (taken by another program, a
forward or another server) and the subnet (three numbers + .x, a private
range not in use) as you type; the default port is 4500
- The personal portal can share the server's port number (TCP beside UDP);
its port is checked against forwards and other services
- A new server comes up at once: the kernel module is loaded and the
network restarted when OpenWrt doesn't know AmneziaWG yet
- A turned-off server is a state of its own: no "tunnel down" or DNS
warnings, "Turned off" in yellow, a white Turn on, and people on it are
not shown as paused
- Pause everyone is removed: turning a server off does the same (a router
left paused keeps its servers off after the update)
- People: a stopped person's card fades and says why across its bottom,
with the one action that lifts it (Resume, +10 GB, Extend 1 month);
people held by a limit or end date sort below the others, paused last
- The person page shows the state as text ("Paused") with a Resume
button, also while their server is off
- The portal tells a paused or ended person just that, even with the
server off, and lets them change nothing until the admin lifts it (the
router refuses too); its notices look like Overview's
- Automatic MTU: with the field empty the tunnel, computers and routers
get 1380 minus AmneziaWG S4 (1368 on Maximum), phones and tablets 1280;
a typed MTU still caps phones and tablets at 1280, and servers on the
old default 1380 move to automatic (phones and tablets get "Update
config", their old files keep working)
- Only procd's agent runs: a second copy (started by hand or left over)
refuses to start or is ended within 5 minutes, so no more stray paused
and resumed events; a device that leaves the tunnel is offline at once
- The installer picks the newest release (it took the lowest), DNS
lookups can't hang, and tooltips and floating cards close on scroll and
on leaving the page
65 lines
3.1 KiB
TypeScript
65 lines
3.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
||
import { parseCidr, portalPortHelp, portHelp, rangeHelp, rangeOf, subnetOf } from '../src/admin/netcheck';
|
||
|
||
const nets = [
|
||
{ name: 'lan', cidr: '10.0.1.0/24' },
|
||
{ name: 'loopback', cidr: '127.0.0.0/8' },
|
||
{ name: 'wan', cidr: '109.173.124.0/23' },
|
||
{ name: 'guest', cidr: '192.168.0.0/16' },
|
||
];
|
||
|
||
describe('netcheck', () => {
|
||
it('parses subnets like the router', () => {
|
||
expect(parseCidr('10.10.10.5/24')).toEqual({ net: 0x0a0a0a00, size: 256 });
|
||
expect(parseCidr('10.10.10.0/31')).toBeNull();
|
||
expect(parseCidr('10.10.300.0/24')).toBeNull();
|
||
expect(parseCidr('10.10.10.0')).toBeNull();
|
||
});
|
||
|
||
it('converts between a range and its subnet', () => {
|
||
expect(rangeOf('10.77.0.0/24')).toBe('10.77.0');
|
||
expect(subnetOf(' 10.77.0 ')).toBe('10.77.0.0/24');
|
||
});
|
||
|
||
it('explains the device addresses', () => {
|
||
expect(rangeHelp('10.10.10', nets, '10.77.0')).toEqual({
|
||
text: 'Devices get 10.10.10.2 – 10.10.10.254, the router 10.10.10.1.',
|
||
bad: false,
|
||
});
|
||
expect(rangeHelp('10.0.1', nets, '10.77.0')).toEqual({ text: 'lan already uses 10.0.1.x. Try 10.77.0.', bad: true });
|
||
expect(rangeHelp('192.168.5', nets, '10.77.0').text).toBe('guest already uses 192.168.0.0/16. Try 10.77.0.');
|
||
expect(rangeHelp('10.77.0', [{ name: 'Home', cidr: '10.77.0.0/24' }], '10.77.0').text).toBe('Home already uses 10.77.0.x.');
|
||
});
|
||
|
||
it('wants a private range of three numbers', () => {
|
||
expect(rangeHelp('8.8.8', nets, '').text).toBe('Use a private range: 10.x.x, 172.16–31.x or 192.168.x.');
|
||
expect(rangeHelp('172.32.0', nets, '').bad).toBe(true);
|
||
expect(rangeHelp('172.31.0', nets, '').bad).toBe(false);
|
||
expect(rangeHelp('10.10', nets, '').text).toBe('Three numbers, like 10.77.0.');
|
||
expect(rangeHelp('10.10.10.0', nets, '').bad).toBe(true);
|
||
expect(rangeHelp('10.10.256', nets, '').bad).toBe(true);
|
||
});
|
||
|
||
it('says who holds a port', () => {
|
||
const taken = [
|
||
{ from: 53, to: 53, who: 'dnsmasq on this router' },
|
||
{ from: 4000, to: 4100, who: 'port forward “Game”' },
|
||
];
|
||
expect(portHelp(4500, taken, 'Free.')).toEqual({ text: 'Free.', bad: false });
|
||
expect(portHelp(53, taken, '').text).toBe('Used by dnsmasq on this router. Choose another port.');
|
||
expect(portHelp(4050, taken, '').text).toBe('Used by port forward “Game”. Choose another port.');
|
||
expect(portHelp(0, taken, '').text).toBe('Use a port from 1 to 65535.');
|
||
expect(portHelp(Number.NaN, taken, '').bad).toBe(true);
|
||
});
|
||
|
||
it('checks the portal port and the next one for IP links', () => {
|
||
const taken = [{ from: 8444, to: 8444, who: 'nginx on this router' }];
|
||
expect(portalPortHelp(8443, taken, false)).toEqual({ text: 'HTTPS on this port, opened on WAN.', bad: false });
|
||
expect(portalPortHelp(8443, taken, true).text).toBe(
|
||
'Links on IP addresses also need 8444, used by nginx on this router. Choose another port.',
|
||
);
|
||
expect(portalPortHelp(9443, taken, true)).toEqual({ text: 'HTTPS here, plain HTTP for links on IP addresses on 9444.', bad: false });
|
||
expect(portalPortHelp(8444, taken, false).bad).toBe(true);
|
||
});
|
||
});
|