This commit is contained in:
parent
e79383c1cf
commit
fd382ccb93
|
|
@ -58,17 +58,18 @@ function generateKeyPair() {
|
|||
// }
|
||||
|
||||
function addPeerToServer(publicKey, ip) {
|
||||
// const peerEntry = `
|
||||
// [Peer]
|
||||
// PublicKey = ${publicKey}
|
||||
// AllowedIPs = ${ip}/32
|
||||
// `;
|
||||
const peerEntry = `
|
||||
[Peer]
|
||||
PublicKey = ${publicKey}
|
||||
AllowedIPs = ${ip}/32
|
||||
`;
|
||||
|
||||
// fs.appendFileSync(WG_CONF, peerEntry);
|
||||
fs.appendFileSync(WG_CONF, peerEntry);
|
||||
|
||||
// execSync("wg-quick strip wg0 > /tmp/wg0.tmp");
|
||||
// execSync("wg syncconf wg0 /tmp/wg0.tmp");
|
||||
// execSync("rm -f /tmp/wg0.tmp");
|
||||
execSync("wg-quick strip wg0 > /tmp/wg0.tmp");
|
||||
execSync("wg syncconf wg0 /tmp/wg0.tmp");
|
||||
execSync("rm -f /tmp/wg0.tmp");
|
||||
|
||||
execSync(
|
||||
`wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`,
|
||||
{ stdio: "inherit" }
|
||||
|
|
|
|||
Loading…
Reference in New Issue