Files
dawnline/web/src/admin/cores/awg.ts
T
Aemeath dc0f159447
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
Dawnline 0.14.0
- A device is renamed where its name stands on its card: a click on the
  name, Return or Space on it, or Rename in the ⋯ menu turns it into a
  field with the name selected. Return saves, and the words shimmer until
  the router answers. Esc or a click elsewhere puts the old name back. The
  rename window is gone, and the page no longer redraws under a name being
  edited
- Device names take up to 20 characters: letters of any language, digits,
  spaces and - _ . The router refuses anything else when a device is added
  or renamed, so a name can't carry symbols into configurations, file
  names or the AmneziaVPN key. The portal and the admin turn a character
  like that away as it is typed: the field shakes, its outline goes red
  and a short line says why. Suggested names (a phone's model, "Phone 2")
  are stripped of such characters and cut to fit. Names set before this
  stay as they are
- LAN Bypass: Add a device, in the portal and in the admin, has a switch
  that keeps the device's own local network (printer, TV, NAS) reachable
  while it is connected. It is off by default and stays as chosen; the
  admin's device drawer shows it. With home and internet access the switch
  says which addresses still lead to the home network
- Health warns when a server's home network is on one of the subnets home
  routers come with (192.168.0.x, 192.168.1.x and others). People with
  home access who connect from a network on the same addresses reach your
  home instead of their own, LAN Bypass or not
- The router tells when a device can't connect properly. After the problem
  lasts three minutes, the portal card and the admin drawer name it:
  can't finish connecting (the network may block it), connected but no
  data (an outdated configuration, and the card offers Reconnect), on two
  devices at once, or a connection that keeps dropping. Activity lists
  these under Problems, one line per device per hour, and says when the
  device connects normally again
- The set-up sheet's connection line follows what the device does:
  waiting, can't finish, connected, or connected but no data. The sheet
  closes by itself only once data comes through. On the device itself and
  for a router, the steps regroup to what fixes the problem: "Set it up
  again" when the handshake never finishes, "Add the connection again"
  ("Import the configuration again" for a router) when no data comes
- Set-up in the portal: a QR code too long for a camera to read gives its
  place to a code that opens the set-up link (a LAN Bypass configuration
  or a long AmneziaVPN key can be that long). A TV, box or NAS added from
  a phone gets the steps for setting up from another device. Back from
  "Open on the device" keeps the kind, LAN Bypass and the name typed. The
  packet-size note under the kinds is gone
- The portal on phones keeps its place: nothing jumps when an access row
  opens or folds, a notice comes or goes, or Safari redraws the cards. A
  reload, or coming back from the VPN app, opens where the page was. Cards
  glide to their new height, and an animation interrupted half-way goes on
  from where it is instead of snapping. A double click no longer closes
  the sheet it just opened
- In the admin, a device's drawer has its own MTU and keep-alive (empty
  means the server's), each with a Change dialog. A change touches only
  that device's configuration and restarts nothing on the router. Opening
  the drawer no longer counts as handing out the configuration: "Update
  config" stays until the new configuration is shown as a QR code,
  downloaded or copied ("Show the new configuration"). New keys set the
  device up again, as the portal's Reconnect does
- "Speed now" on a server's Overview is live: one point a second over the
  last two minutes, all there as soon as the Overview opens. The agent
  keeps those two minutes in memory and writes them out only while someone
  is looking
- Disguise values that AmneziaWG refuses or crashes on are stopped before
  they reach the kernel. That covers overlapping H1-H4, Jmin above Jmax,
  broken I1-I5 tags, padding under 12 with header protection, and more.
  Import and restore refuse them. After a hand edit in uci, the server's
  tunnel stays down and Health and the service log say why and what to do.
  Errors are full sentences in the reader's language
- The header protection key no longer shows in the status that read-only
  users can see: the Server page says only that the key is set, and each
  device's configuration still has it. The server no longer turns off
  WireGuard's protection against handshake floods (devices keep
  DisableCookies). A device can't be added with a server's own key
- An AmneziaWG update whose kernel module can't be swapped (another
  AmneziaWG interface holds the old one) no longer fails. It is installed,
  the tunnels come back on the old module, and Health and Components say
  the update starts after a reboot. On apk firmware, an install that apk
  left at the old version counts as failed. A module installed by hand is
  recorded, so after a firmware upgrade Health can tell that it is gone
- Dawnline reads only its own tunnels, each one separately. Another
  AmneziaWG interface on the router no longer slows the agent's
  once-a-second check, has its keys read or breaks Dawnline's reads. A
  portal request reads only that person's server: one process however many
  servers there are
- Fewer false disconnects: a tunnel that netifd sets up again no longer
  logs everyone as leaving and coming back, and a device with a long
  keep-alive stays online between handshakes. One configuration on two
  devices isn't logged as roaming every few seconds, and new keys end the
  old session at once. A tunnel that is missing devices is synced within a
  minute, and traffic across a tunnel restart is no longer undercounted
- Renaming a server no longer restarts its tunnel. If a tunnel's interface
  is edited outside Dawnline (LuCI, uci), the watchdog sets it up again
  with Dawnline's settings and names only the changed options. The routing
  rules for "Internet like a home device" change one at a time, new ones
  first, so traffic never falls between them. Health and the Server page
  warn when the address's AAAA record isn't this router's, or the router
  has no public IPv6: devices that prefer IPv6 fail to connect
- The README screenshots come in English and Russian; the portal's are
  taken from its demo. The demo has a switch beside × in the set-up sheet
  to show each state of the connection line. In Russian, long labels in
  the admin's wide option buttons wrap under their icon. DESIGN.md
  describes the switch, renaming on the card, the shimmer, the shake and
  how the portal scrolls. New tests cover link states, the meter, access,
  Health, firewall rules, network settings and packages
2026-10-22 00:11:50 +03:00

497 lines
19 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// The AmneziaWG core in the admin: how a device connects (.conf, AmneziaVPN
// key, QR), the disguise and its parameters, and the core's own settings on
// Server → AmneziaWG. Plain WireGuard is AmneziaWG with the disguise off.
import type { AwgConfig, Server, Status } from '../../shared/types';
import { E } from '../e';
import { api } from '../api';
import { button } from '../ui/button';
import { confirmDialog } from '../ui/modal';
import { copyText, downloadFile } from '../ui/files';
import { attempt, notify } from '../ui/toast';
import { input } from '../ui/controls';
import { callout, card, firstBad, group, liveRow, row } from '../ui/layout';
import { qrCode } from '../ui/qr';
import { keepaliveHelp, mtuHelp, portHelp, type PortHold } from '../netcheck';
import { vpnKey } from '../../shared/vpnkey';
import { icon } from '../../shared/icons';
import { methodInfo, methodPicker, type Method, defaultMethod, legacyTitle } from '../disguise';
import { fmt, fill, num, plural } from '../../shared/i18n';
import { coreHead, type Core, type CoreCtx } from './common';
/** `.conf` names of the disguise parameters, in file order. */
const CONF: [string, string][] = [
['jc', 'Jc'],
['jmin', 'Jmin'],
['jmax', 'Jmax'],
['s1', 'S1'],
['s2', 'S2'],
['s3', 'S3'],
['s4', 'S4'],
['h1', 'H1'],
['h2', 'H2'],
['h3', 'H3'],
['h4', 'H4'],
['i1', 'I1'],
['i2', 'I2'],
['i3', 'I3'],
['i4', 'I4'],
['i5', 'I5'],
['header_protection_key', 'HeaderProtectionKey'],
['content_padding_addition', 'ContentPaddingAddition'],
['rekey_after_time', 'RekeyAfterTime'],
['rekey_timeout', 'RekeyTimeout'],
['reject_after_time', 'RejectAfterTime'],
['keepalive_timeout', 'KeepaliveTimeout'],
['max_handshake_attempts', 'MaxHandshakeAttempts'],
['random_trailers', 'RandomTrailers'],
['disable_cookies', 'DisableCookies'],
];
/**
* The applied parameters, grouped by what they do, with a plain-language
* line per group. Collapsed by default; copyable as config lines. The header
* protection key stays out of the status (read-only users can read it): the
* view says there is one, and each device's file has it.
*/
function paramsView(o: Record<string, string>, hpk: boolean): HTMLElement | null {
const has = (k: string) => (k === 'header_protection_key' ? hpk : o[k] != null && o[k] !== '');
const keys = CONF.filter(([k]) => has(k));
if (!keys.length) return null;
const val = (k: string, name: string) =>
E('span', { class: 'dl-pv' }, [E('i', {}, name), E('b', {}, k === 'header_protection_key' ? _('set', 'key') : o[k])]);
const group = (title: string, ic: string, text: string, ks: string[]) => {
const present = CONF.filter(([k]) => ks.includes(k) && has(k));
return present.length
? E('div', { class: 'dl-pgroup' }, [
E('div', { class: 'dl-pgroup-head' }, [icon(ic), E('b', {}, title)]),
E('p', {}, text),
E(
'div',
{ class: 'dl-pvals' },
present.map(([k, n]) => val(k, n)),
),
])
: '';
};
const jc = Number(o.jc || 0);
const signature = (o.i1 ?? '').includes('0x8580')
? _('A first packet shaped like a DNS answer.')
: _('Extra packets sent before the handshake.');
const conf = keys
.filter(([k]) => k !== 'header_protection_key')
.map(([k, n]) => `${n} = ${o[k]}`)
.join('\n');
const body = E('div', { class: 'dl-pgrid' }, [
group(
_('Junk packets'),
'zap',
jc
? fmt(
N_(jc, '%s random packet of %s–%s bytes before each handshake.', '%s random packets of %s–%s bytes before each handshake.'),
num(jc),
o.jmin,
o.jmax,
)
: _('No junk packets.'),
['jc', 'jmin', 'jmax'],
),
group(
_('Padding'),
'archive',
_('Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.'),
['s1', 's2', 's3', 's4'],
),
group(_('Packet types'), 'key', _('The values that replace WireGuard’s recognisable message types.'), ['h1', 'h2', 'h3', 'h4']),
group(_('Signatures'), 'globe', signature, ['i1', 'i2', 'i3', 'i4', 'i5']),
group(_('Protection'), 'lock', _('AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.'), [
'header_protection_key',
'content_padding_addition',
'random_trailers',
'disable_cookies',
]),
group(_('Timing'), 'clock', _('Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.'), [
'rekey_after_time',
'rekey_timeout',
'reject_after_time',
'keepalive_timeout',
'max_handshake_attempts',
]),
]);
return E('details', { class: 'dl-params' }, [
E('summary', {}, [
icon('chevron'),
E('span', {}, _('Current parameters')),
E('span', { class: 'dl-pcount' }, String(keys.length)),
E('span', { class: 'dl-spacer' }),
E(
'button',
{
type: 'button',
class: 'dl-linkbtn',
click: (ev: Event) => {
ev.preventDefault();
copyText(conf, hpk ? _('Parameters copied. The header protection key is in each device’s file.') : _('Parameters copied'));
},
},
_('Copy as config'),
),
]),
body,
]);
}
/** One configuration line, highlighted; private and preshared keys masked unless shown. */
function confLine(line: string, reveal: boolean): Node {
if (/^\s*\[.+\]\s*$/.test(line)) return E('span', { class: 'dl-conf-sec' }, line);
const m = /^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(line);
if (!m) return document.createTextNode(line);
const secret = /^(\s*)(PrivateKey|PresharedKey)\b/.test(line);
return E('span', {}, [
E('span', { class: 'dl-conf-k' }, m[1]),
' ',
secret && !reveal ? E('span', { class: 'dl-conf-mask' }, '••••••••••••••••') : m[2],
]);
}
/** The .conf as a file card (download) and a folded, highlighted view with copy and a hidden key. */
function fileCard(cfg: AwgConfig): HTMLElement {
let reveal = false;
const pre = E('pre', { class: 'dl-conf' });
const paint = () =>
dom.content(
pre,
cfg.conf.split('\n').flatMap((l, i) => (i ? ['\n', confLine(l, reveal)] : [confLine(l, reveal)])),
);
const eye = E(
'button',
{
type: 'button',
class: 'dl-chipbtn',
click: (ev: Event) => {
ev.preventDefault();
reveal = !reveal;
dom.content(eye, [icon(reveal ? 'x' : 'key'), reveal ? _('Hide key') : _('Show key')]);
paint();
},
},
[icon('key'), _('Show key')],
);
paint();
const size = new Blob([cfg.conf]).size;
return E('div', { class: 'dl-stack gap8' }, [
E('div', { class: 'dl-filecard' }, [
E('span', { class: 'dl-filecard-ic' }, '.conf'),
E('span', { class: 'dl-stack' }, [
E('span', { class: 'dl-mono dl-ellipsis' }, cfg.filename),
E('span', { class: 'dl-sub' }, `AmneziaWG · ${plural(size, '%s byte', '%s bytes')}`),
]),
button([icon('download'), ' ', _('Download')], () => downloadFile(cfg.filename, cfg.conf, 'application/octet-stream'), 'positive'),
]),
E('details', { class: 'dl-params' }, [
E('summary', {}, [
icon('chevron'),
E('span', {}, _('Configuration')),
E('span', { class: 'dl-spacer' }),
eye,
E(
'button',
{
type: 'button',
class: 'dl-chipbtn',
click: (ev: Event) => {
ev.preventDefault();
copyText(cfg.conf, _('Configuration copied'));
},
},
[icon('copy'), _('Copy')],
),
]),
pre,
]),
]);
}
/** The configuration carries no disguise values: plain WireGuard, any WireGuard app takes it. */
export function plainWg(cfg: AwgConfig): boolean {
const o = (cfg.amnezia.obfuscation ?? {}) as Record<string, string | undefined>;
const neutral: Record<string, string> = { h1: '1', h2: '2', h3: '3', h4: '4' };
return Object.entries(o).every(([k, v]) => v == null || v === '' || v === (neutral[k] ?? '0'));
}
/** File / key / QR switcher for a client configuration; opens on the file unless asked otherwise. */
export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr' = 'file'): Promise<HTMLElement> {
if (!cfg.has_private_key)
return E(
'div',
{ class: 'dl-hint' },
_('This device generated its own keys in the browser, so its full configuration only exists on that device.'),
);
const key = await vpnKey(cfg, cfg.server);
const panes: Record<string, () => Node> = {
qr: () =>
E('div', { class: 'dl-qr-pane' }, [
qrCode(cfg.conf),
E(
'span',
{ class: 'dl-sub' },
plainWg(cfg)
? _('Scan with AmneziaVPN or any WireGuard app on the device.')
: _('Scan with AmneziaVPN or AmneziaWG on the device.'),
),
]),
key: () =>
E('div', { class: 'dl-stack gap8' }, [
E('div', { class: 'dl-linkbox' }, [E('span', { class: 'dl-mono' }, key), button(_('Copy'), () => copyText(key, _('Key copied')))]),
// The app's own labels (portal/setup.ts has where they come from): + in its bottom bar, Insert, Continue.
E(
'span',
{ class: 'dl-sub' },
fmt(_('AmneziaVPN → %s. Keep it private.'), ['+', _('Insert', 'AmneziaVPN app'), _('Continue', 'AmneziaVPN app')].join(' → ')),
),
]),
file: () => fileCard(cfg),
};
const body = E('div', { class: 'dl-connect-body' });
const seg = E('div', { class: 'dl-seg' });
const show = (id: string) => {
seg.querySelectorAll('button').forEach((b) => b.classList.toggle('on', b.dataset.id === id));
dom.content(body, panes[id]());
};
for (const [id, label] of [
['file', _('File')],
['key', _('Key')],
['qr', _('QR code')],
])
seg.appendChild(E('button', { type: 'button', 'data-id': id, click: () => show(id) }, label));
show(initial);
return E('div', { class: 'dl-stack gap12' }, [seg, body]);
}
/** Switch the disguise (every device imports its configuration again). */
async function applyDisguise(ctx: CoreCtx, srv: Server, m: Method, same: boolean) {
const info = methodInfo(m)!;
const people = ctx.st.people.filter((p) => p.server === srv.id);
const devices = people.reduce((n, p) => n + p.devices.length, 0);
const ok = await confirmDialog(
same ? _('Generate new disguise values?') : fmt(_('Switch to %s?'), info.title),
[
plural(
devices,
'%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).',
'%s AmneziaWG devices 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.') : '',
ctx.st.servers.length === 1 && devices ? _('To keep the old disguise for some people, add a second server and move them there.') : '',
]
.filter(Boolean)
.join(' '),
same ? _('Generate and apply') : _('Switch and apply'),
true,
);
if (!ok) return;
if (await attempt(() => api.serverObfuscation(srv.id, m), same ? _('New values applied') : fmt(_('%s applied'), info.title))) {
notify(_('Devices are marked “Update config” until they import again.'), 'info', 6000);
await ctx.refresh();
}
}
/** Server → AmneziaWG: listening port, what goes into every configuration, disguise, tunnel. */
export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement {
const st: Status = ctx.st;
const port = input(String(srv.port), { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' });
const mtu = input(srv.mtu ? String(srv.mtu) : '', {
placeholder: _('Auto'),
inputmode: 'numeric',
class: 'cbi-input-text dl-w-port dl-mono',
});
const ka = input(String(srv.keepalive ?? ''), { placeholder: '25', inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' });
const current = methodInfo(srv.preset) ? (srv.preset as Method) : undefined;
let selected: Method = current ?? defaultMethod(st.awg);
const apply = button('', () => applyDisguise(ctx, srv, selected, selected === current), 'neutral');
const label = () =>
dom.content(
apply,
selected === current ? [icon('reset'), ' ', _('Generate new values')] : [fmt(_('Switch to %s'), methodInfo(selected)!.title)],
);
label();
const tools = st.awg_state?.tools !== false;
// Who holds which port arrives once the card is built (netstat on the
// router); until then the port is only checked for its range.
let holds: PortHold[] = [];
const portRow = liveRow(_('UDP port'), port, () =>
portHelp(
Number(port.value),
holds,
[
_('Opened on the WAN firewall automatically.'),
Number(port.value) === 4500 ? _('4500 is IPsec’s port: most networks let it through.') : '',
]
.filter(Boolean)
.join(' '),
),
);
api
.serverPorts(srv.id)
.then((r) => {
holds = r.udp_taken ?? [];
portRow.refresh();
})
.catch(() => {});
const mtuRow = liveRow('MTU', mtu, () => mtuHelp(mtu.value, srv.mtus));
const kaRow = liveRow(_('Keep-alive'), ka, () => keepaliveHelp(ka.value));
return card(
'',
[
coreHead('AmneziaWG', srv.ifname),
group('globe', _('Listening'), _('Where devices reach this core from the internet'), [portRow]),
group('file', _('In every device configuration'), _('Changing these marks devices “Update config” until they import again'), [
mtuRow,
kaRow,
]),
group('shield', _('Disguise'), _('So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard'), [
// A server from before 0.8 on the old junk-only disguise: it runs, but is no longer offered.
legacyTitle(srv.preset)
? callout(
'warn',
fill(
_(
'%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again.',
),
E('b', {}, legacyTitle(srv.preset)!),
E('b', {}, _('Balanced')),
E('b', {}, _('Maximum')),
),
)
: '',
methodPicker(
st.awg,
selected,
(m) => {
selected = m;
label();
},
current,
tools,
),
// Only about an installed AmneziaWG: without one the server page says what to install.
tools && !st.awg.v3
? callout(
'info',
fill(
_('This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1.'),
E('b', {}, _('Maximum')),
),
)
: '',
paramsView(srv.obf ?? {}, srv.hpk) ?? '',
E('div', { class: 'dl-row-end' }, [
E('span', { class: 'dl-sub' }, _('Applies at once: every AmneziaWG device imports its configuration again.')),
apply,
]),
]),
E('details', { class: 'dl-params' }, [
E('summary', {}, [icon('chevron'), E('span', {}, _('Tunnel')), E('span', { class: 'dl-pcount' }, '3')]),
E('div', { class: 'dl-params-body' }, [
row(_('Interface'), E('span', { class: 'dl-mono' }, `${srv.ifname} · ${fmt(_('router %s'), srv.address)}`)),
row(_('Tunnel subnet'), E('span', { class: 'dl-mono' }, srv.subnet), _('Device addresses come from it.')),
row(
_('Server public key'),
E('span', { class: 'dl-keyrow' }, [
E('code', { class: 'dl-mono' }, srv.public_key),
button([icon('copy')], () => copyText(srv.public_key, _('Public key copied')), 'neutral', {
title: _('Copy'),
class: 'cbi-button cbi-button-neutral dl-icon-only sm',
}),
]),
),
]),
]),
],
[
E('span', { class: 'dl-sub' }, _('Port, MTU and keep-alive apply at once.')),
button(
_('Save'),
() => {
// The help lines already say what is wrong: do not send it anyway.
const bad = firstBad([portRow, mtuRow, kaRow]);
if (bad) {
notify(bad, 'warning');
return;
}
return ctx.save({ port: port.value, mtu: mtu.value, keepalive: ka.value }, _('AmneziaWG saved'));
},
'positive',
),
],
);
}
/** Overview: the disguise in use, its stealth and speed, and the values devices carry in words. */
function overviewTile(srv: Server): HTMLElement {
const m = methodInfo(srv.preset);
const o = srv.obf ?? {};
const segs = (n: number, cls: string) =>
E(
'span',
{ class: `dl-segs ${cls}` },
[0, 1, 2, 3].map((i) => E('i', { class: i < n ? 'on' : '' })),
);
const chips: string[] = [];
if (+o.jc) chips.push(`${plural(+o.jc, '%s junk', '%s junk')} · ${o.jmin}–${o.jmax} ${_('B')}`);
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(/0x(8580|0100)0001/.test(o.i1) ? _('DNS-like first packets') : _('Signature packets'));
if (srv.hpk) 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' }, [
E('div', { class: 'dl-bento-head' }, [
E('span', { class: 'dl-metric-label' }, _('Disguise')),
E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}&section=awg` }, _('Change')),
]),
E('div', { class: 'dl-disg-id' }, [
E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')),
E('span', { class: 'dl-stack' }, [
E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? _('Custom', 'disguise'))),
E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? _('Switch to Balanced or Maximum') : _('Set by hand')),
]),
]),
m
? E('div', { class: 'dl-disg-meters' }, [
E('span', {}, _('Stealth')),
segs(m.stealth, 'acc'),
E('span', {}, _('Speed')),
segs(m.speed, 'ok'),
])
: '',
E(
'div',
{ class: 'dl-disg-chips' },
chips.map((c) => E('span', {}, c)),
),
]);
}
export const awg: Core = {
id: 'awg',
label: 'AmneziaWG',
settingsCard,
overviewTile,
connectBlock,
qrText: (cfg) => cfg.conf,
// Labels are getters: the text is made when a menu is drawn.
appKey: {
get label() {
return _('Copy AmneziaVPN config');
},
make: (cfg) => vpnKey(cfg, cfg.server),
},
file: {
get label() {
return _('Download AmneziaWG config');
},
make: (cfg) => ({ name: cfg.filename, text: cfg.conf }),
},
};