Bernd Storath
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
3 deletions
-
src/server/utils/wgHelper.ts
|
|
@ -85,14 +85,19 @@ PostDown = ${iptablesTemplate(hooks.postDown, wgInterface)}`; |
|
|
|
client.postUp ? `PostUp = ${client.postUp}` : null, |
|
|
|
client.preDown ? `PreDown = ${client.preDown}` : null, |
|
|
|
client.postDown ? `PostDown = ${client.postDown}` : null, |
|
|
|
].filter((v) => v !== null); |
|
|
|
]; |
|
|
|
|
|
|
|
const dnsServers = client.dns ?? userConfig.defaultDns; |
|
|
|
const dnsLine = |
|
|
|
dnsServers.length > 0 ? `DNS = ${dnsServers.join(', ')}` : null; |
|
|
|
|
|
|
|
const extraLines = [dnsLine, ...hookLines].filter((v) => v !== null); |
|
|
|
|
|
|
|
return `[Interface]
|
|
|
|
PrivateKey = ${client.privateKey} |
|
|
|
Address = ${address} |
|
|
|
DNS = ${(client.dns ?? userConfig.defaultDns).join(', ')} |
|
|
|
MTU = ${client.mtu} |
|
|
|
${hookLines.length ? `${hookLines.join('\n')}\n` : ''} |
|
|
|
${extraLines.length ? `${extraLines.join('\n')}\n` : ''} |
|
|
|
[Peer] |
|
|
|
PublicKey = ${wgInterface.publicKey} |
|
|
|
PresharedKey = ${client.preSharedKey} |
|
|
|