refactor to support CIDR and legacy notation
for WG_DEFAULT_ADDRESS
This commit is contained in:
@@ -73,7 +73,7 @@ module.exports = class WireGuard {
|
||||
|
||||
throw err;
|
||||
});
|
||||
// await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ' + WG_DEVICE + ' -j MASQUERADE`);
|
||||
// await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_SERVER_ADDRESS/${WG_DEFAULT_ADDRESS_RANGE} -o ' + WG_DEVICE + ' -j MASQUERADE`);
|
||||
// await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT');
|
||||
// await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT');
|
||||
// await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT');
|
||||
@@ -315,7 +315,7 @@ Endpoint = ${WG_HOST}:${WG_PORT}`;
|
||||
async updateClientAddress({ clientId, address }) {
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
if (!Util.isValidIPv4(address)) {
|
||||
if (!ip.isV4Format(address)) {
|
||||
throw new ServerError(`Invalid Address: ${address}`, 400);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user