Feat: Server Endpoint (#1785)

* add server endpoint to client

* be able to update endpoint over api
This commit is contained in:
Bernd Storath
2025-04-01 16:13:51 +02:00
committed by GitHub
parent 9df049d3f4
commit e92ee0464e
8 changed files with 30 additions and 6 deletions
+2
View File
@@ -34,6 +34,8 @@ class WireGuard {
result.push(wg.generateServerPeer(client));
}
result.push('');
WG_DEBUG('Saving Config...');
await fs.writeFile(
`/etc/wireguard/${wgInterface.name}.conf`,
+6 -1
View File
@@ -13,11 +13,16 @@ export const wg = {
...(client.serverAllowedIps ?? []),
];
const extraLines = [];
if (client.serverEndpoint) {
extraLines.push(`Endpoint = ${client.serverEndpoint}`);
}
return `# Client: ${client.name} (${client.id})
[Peer]
PublicKey = ${client.publicKey}
PresharedKey = ${client.preSharedKey}
AllowedIPs = ${allowedIps.join(', ')}`;
AllowedIPs = ${allowedIps.join(', ')}${extraLines.length ? `\n${extraLines.join('\n')}` : ''}`;
},
generateServerInterface: (wgInterface: InterfaceType, hooks: HooksType) => {