AmneziaWG 2.0 (#2226)

* feat!: awg

* feat: add description to fields, add I5

* fix: awg i18n

* fix: types

* minor fixes

* Remove TODO comment from types.ts

Removed TODO comment for more validation.

---------

Co-authored-by: Bernd Storath <999999bst@gmail.com>
This commit is contained in:
Alexander Chepurnoy
2025-11-12 13:46:16 +07:00
committed by GitHub
parent a8ba7f7247
commit 6a282e6ab9
20 changed files with 1491 additions and 21 deletions
+18 -9
View File
@@ -12,7 +12,23 @@ export const OLD_ENV = {
PASSWORD_HASH: process.env.PASSWORD_HASH,
};
const OVERRIDE_AUTO_AWG = process.env.OVERRIDE_AUTO_AWG?.toLowerCase();
const detectAwg = async (): Promise<'awg' | 'wg'> => {
/** TODO: delete on next major version */
if (process.env.EXPERIMENTAL_AWG === 'true') {
const OVERRIDE_AUTO_AWG = process.env.OVERRIDE_AUTO_AWG?.toLowerCase();
if (
OVERRIDE_AUTO_AWG === ('wg' as const) ||
OVERRIDE_AUTO_AWG === ('awg' as const)
) {
return OVERRIDE_AUTO_AWG;
} else {
return await exec('modinfo amneziawg')
.then(() => 'awg' as const)
.catch(() => 'wg' as const);
}
} else return 'wg';
};
export const WG_ENV = {
/** UI is hosted on HTTP instead of HTTPS */
@@ -21,14 +37,7 @@ export const WG_ENV = {
PORT: assertEnv('PORT'),
/** If IPv6 should be disabled */
DISABLE_IPV6: process.env.DISABLE_IPV6 === 'true',
/** Override automatic detection */
OVERRIDE_AUTO_AWG:
OVERRIDE_AUTO_AWG === ('wg' as const) ||
OVERRIDE_AUTO_AWG === ('awg' as const)
? OVERRIDE_AUTO_AWG
: undefined,
/** TODO: delete on next major version */
EXPERIMENTAL_AWG: process.env.EXPERIMENTAL_AWG === 'true',
WG_EXECUTABLE: await detectAwg(),
};
export const WG_INITIAL_ENV = {