|
@ -19,6 +19,9 @@ class WireGuard { |
|
|
async #saveWireguardConfig() { |
|
|
async #saveWireguardConfig() { |
|
|
const system = await Database.getSystem(); |
|
|
const system = await Database.getSystem(); |
|
|
const clients = await Database.getClients(); |
|
|
const clients = await Database.getClients(); |
|
|
|
|
|
const cidrBlock = ip.cidrSubnet( |
|
|
|
|
|
system.userConfig.addressRange |
|
|
|
|
|
).subnetMaskLength; |
|
|
let result = ` |
|
|
let result = ` |
|
|
# Note: Do not edit this file directly. |
|
|
# Note: Do not edit this file directly. |
|
|
# Your changes will be overwritten! |
|
|
# Your changes will be overwritten! |
|
@ -26,7 +29,7 @@ class WireGuard { |
|
|
# Server |
|
|
# Server |
|
|
[Interface] |
|
|
[Interface] |
|
|
PrivateKey = ${system.interface.privateKey} |
|
|
PrivateKey = ${system.interface.privateKey} |
|
|
Address = ${system.interface.address} |
|
|
Address = ${system.interface.address}/${cidrBlock} |
|
|
ListenPort = ${system.wgPort} |
|
|
ListenPort = ${system.wgPort} |
|
|
PreUp = ${system.iptables.PreUp} |
|
|
PreUp = ${system.iptables.PreUp} |
|
|
PostUp = ${system.iptables.PostUp} |
|
|
PostUp = ${system.iptables.PostUp} |
|
|