This commit is contained in:
=bhagwanSingh 2025-12-16 07:29:45 +05:30
parent e79383c1cf
commit fd382ccb93
1 changed files with 10 additions and 9 deletions

View File

@ -58,17 +58,18 @@ function generateKeyPair() {
// } // }
function addPeerToServer(publicKey, ip) { function addPeerToServer(publicKey, ip) {
// const peerEntry = ` const peerEntry = `
// [Peer] [Peer]
// PublicKey = ${publicKey} PublicKey = ${publicKey}
// AllowedIPs = ${ip}/32 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( execSync(
`wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`, `wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`,
{ stdio: "inherit" } { stdio: "inherit" }