|
|
|
@ -118,8 +118,8 @@ PostDown = ${WG_POST_DOWN} |
|
|
|
# Client: ${client.name} (${clientId}) |
|
|
|
[Peer] |
|
|
|
PublicKey = ${client.publicKey} |
|
|
|
PresharedKey = ${client.preSharedKey} |
|
|
|
AllowedIPs = ${client.address}/32, ${client.address6}/128`;
|
|
|
|
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : '' |
|
|
|
}AllowedIPs = ${client.address}/32`;
|
|
|
|
} |
|
|
|
|
|
|
|
debug('Config saving...'); |
|
|
|
@ -150,7 +150,7 @@ AllowedIPs = ${client.address}/32, ${client.address6}/128`; |
|
|
|
createdAt: new Date(client.createdAt), |
|
|
|
updatedAt: new Date(client.updatedAt), |
|
|
|
allowedIPs: client.allowedIPs, |
|
|
|
|
|
|
|
downloadableConfig: 'privateKey' in client, |
|
|
|
persistentKeepalive: null, |
|
|
|
latestHandshakeAt: null, |
|
|
|
transferRx: null, |
|
|
|
@ -207,16 +207,17 @@ AllowedIPs = ${client.address}/32, ${client.address6}/128`; |
|
|
|
const isDnsSet = WG_DEFAULT_DNS || WG_DEFAULT_DNS6; |
|
|
|
const dnsServers = [WG_DEFAULT_DNS, WG_DEFAULT_DNS6].filter((item) => !!item).join(', '); |
|
|
|
|
|
|
|
return `[Interface]
|
|
|
|
PrivateKey = ${client.privateKey} |
|
|
|
Address = ${client.address}/24, ${client.address6}/64 |
|
|
|
${isDnsSet ? `DNS = ${dnsServers}\n` : ''}\ |
|
|
|
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}`;
|
|
|
|
} |
|
|
|
|