Browse Source

Update WireGuard.js

pull/1690/head
alexn707 5 months ago
committed by GitHub
parent
commit
7222d0afb2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 37
      src/lib/WireGuard.js

37
src/lib/WireGuard.js

@ -26,6 +26,15 @@ const {
WG_POST_DOWN,
WG_ENABLE_EXPIRES_TIME,
WG_ENABLE_ONE_TIME_LINKS,
JC,
JMIN,
JMAX,
S1,
S2,
H1,
H2,
H3,
H4,
} = require('../config');
module.exports = class WireGuard {
@ -54,6 +63,15 @@ module.exports = class WireGuard {
privateKey,
publicKey,
address,
jc: JC,
jmin: JMIN,
jmax: JMAX,
s1: S1,
s2: S2,
h1: H1,
h2: H2,
h3: H3,
h4: H4,
},
clients: {},
};
@ -109,6 +127,16 @@ PreUp = ${WG_PRE_UP}
PostUp = ${WG_POST_UP}
PreDown = ${WG_PRE_DOWN}
PostDown = ${WG_POST_DOWN}
Jc = ${config.server.jc}
Jmin = ${config.server.jmin}
Jmax = ${config.server.jmax}
S1 = ${config.server.s1}
S2 = ${config.server.s2}
H1 = ${config.server.h1}
H2 = ${config.server.h2}
H3 = ${config.server.h3}
H4 = ${config.server.h4}
Jc = ${config.server.jc}
`;
for (const [clientId, client] of Object.entries(config.clients)) {
@ -218,6 +246,15 @@ PrivateKey = ${client.privateKey ? `${client.privateKey}` : 'REPLACE_ME'}
Address = ${client.address}/24
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\
${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\
Jc = ${config.server.jc}
Jmin = ${config.server.jmin}
Jmax = ${config.server.jmax}
S1 = ${config.server.s1}
S2 = ${config.server.s2}
H1 = ${config.server.h1}
H2 = ${config.server.h2}
H3 = ${config.server.h3}
H4 = ${config.server.h4}
[Peer]
PublicKey = ${config.server.publicKey}

Loading…
Cancel
Save