forked from mirrors/amnezia-wg-easy
WireGuard.js: remove redundant newline char in client config generation
This commit is contained in:
parent
bfd281fc9f
commit
8aafe6b8c9
1 changed files with 9 additions and 6 deletions
|
@ -196,19 +196,22 @@ AllowedIPs = ${client.address}/32`;
|
||||||
const config = await this.getConfig();
|
const config = await this.getConfig();
|
||||||
const client = await this.getClient({ clientId });
|
const client = await this.getClient({ clientId });
|
||||||
|
|
||||||
return `
|
const interface = `[Interface]
|
||||||
[Interface]
|
|
||||||
PrivateKey = ${client.privateKey}
|
PrivateKey = ${client.privateKey}
|
||||||
Address = ${client.address}/24
|
Address = ${client.address}/24
|
||||||
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''}
|
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\
|
||||||
${WG_MTU ? `MTU = ${WG_MTU}` : ''}
|
${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\
|
||||||
|
`;
|
||||||
|
|
||||||
[Peer]
|
const peer = `[Peer]
|
||||||
PublicKey = ${config.server.publicKey}
|
PublicKey = ${config.server.publicKey}
|
||||||
PresharedKey = ${client.preSharedKey}
|
PresharedKey = ${client.preSharedKey}
|
||||||
AllowedIPs = ${WG_ALLOWED_IPS}
|
AllowedIPs = ${WG_ALLOWED_IPS}
|
||||||
PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE}
|
PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE}
|
||||||
Endpoint = ${WG_HOST}:${WG_PORT}`;
|
Endpoint = ${WG_HOST}:${WG_PORT}
|
||||||
|
`;
|
||||||
|
|
||||||
|
return [interface, peer].join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getClientQRCodeSVG({ clientId }) {
|
async getClientQRCodeSVG({ clientId }) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue