This commit is contained in:
parent
e79383c1cf
commit
fd382ccb93
|
|
@ -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" }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue