This commit is contained in:
Emile Nijssen 2021-05-23 12:02:56 +02:00
parent 18b6ce7c78
commit 9d355f67d8
12 changed files with 60 additions and 37 deletions

View file

@ -34,8 +34,11 @@ module.exports = class WireGuard {
},
clients: {},
};
await this.saveConfig();
}
await Util.exec('wg-quick up wg0');
return config;
});
}
@ -99,7 +102,7 @@ AllowedIPs = ${client.address}/32`;
const [
publicKey,
preSharedKey, // eslint-disable-line no-unused-vars
endpoint,
endpoint, // eslint-disable-line no-unused-vars
allowedIps, // eslint-disable-line no-unused-vars
latestHandshakeAt,
transferRx,
@ -110,9 +113,6 @@ AllowedIPs = ${client.address}/32`;
const client = clients.find(client => client.publicKey === publicKey);
if (!client) return;
client.endpoint = endpoint === '(none)'
? null
: endpoint;
client.latestHandshakeAt = latestHandshakeAt === '0'
? null
: new Date(Number(`${latestHandshakeAt}000`));