Merge branch 'feat-h3' into master

This commit is contained in:
Philip H 2024-03-14 08:48:53 +01:00 committed by GitHub
commit 1a3cff855e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 431 additions and 181 deletions

View file

@ -110,8 +110,8 @@ PostDown = ${WG_POST_DOWN}
# Client: ${client.name} (${clientId})
[Peer]
PublicKey = ${client.publicKey}
PresharedKey = ${client.preSharedKey}
AllowedIPs = ${client.address}/32`;
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
}AllowedIPs = ${client.address}/32`;
}
debug('Config saving...');
@ -141,7 +141,7 @@ AllowedIPs = ${client.address}/32`;
createdAt: new Date(client.createdAt),
updatedAt: new Date(client.updatedAt),
allowedIPs: client.allowedIPs,
downloadableConfig: 'privateKey' in client,
persistentKeepalive: null,
latestHandshakeAt: null,
transferRx: null,
@ -196,16 +196,17 @@ AllowedIPs = ${client.address}/32`;
const config = await this.getConfig();
const client = await this.getClient({ clientId });
return `[Interface]
PrivateKey = ${client.privateKey}
return `
[Interface]
PrivateKey = ${client.privateKey ? `${client.privateKey}` : 'REPLACE_ME'}
Address = ${client.address}/24
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\
${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\
[Peer]
PublicKey = ${config.server.publicKey}
PresharedKey = ${client.preSharedKey}
AllowedIPs = ${WG_ALLOWED_IPS}
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
}AllowedIPs = ${WG_ALLOWED_IPS}
PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE}
Endpoint = ${WG_HOST}:${WG_PORT}`;
}
@ -318,4 +319,9 @@ Endpoint = ${WG_HOST}:${WG_PORT}`;
await this.saveConfig();
}
// Shutdown wireguard
async Shutdown() {
await Util.exec('wg-quick down wg0').catch(() => { });
}
};