mirror of
https://github.com/WeeJeWel/wg-easy.git
synced 2024-12-22 17:19:23 +08:00
make WG_DEFAULT_DNS optional, fixes #40
This commit is contained in:
parent
016382dd01
commit
985d886362
@ -16,12 +16,16 @@ You have found the easiest way to install & manage WireGuard on any Linux host!
|
|||||||
|
|
||||||
* All-in-one: WireGuard + Web UI.
|
* All-in-one: WireGuard + Web UI.
|
||||||
* Easy installation, simple to use.
|
* Easy installation, simple to use.
|
||||||
* List, create, delete, enable & disable clients.
|
* List, create, edit, delete, enable & disable clients.
|
||||||
* Show a client's QR code.
|
* Show a client's QR code.
|
||||||
* Download a client's configuration file.
|
* Download a client's configuration file.
|
||||||
* Statistics for which clients are connected.
|
* Statistics for which clients are connected.
|
||||||
* Gravatar support.
|
* Gravatar support.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* A host with a kernel that supports WireGuard (all modern kernels).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### 1. Install Docker
|
### 1. Install Docker
|
||||||
|
@ -6,5 +6,7 @@ module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/';
|
|||||||
module.exports.WG_HOST = process.env.WG_HOST;
|
module.exports.WG_HOST = process.env.WG_HOST;
|
||||||
module.exports.WG_PORT = process.env.WG_PORT || 51820;
|
module.exports.WG_PORT = process.env.WG_PORT || 51820;
|
||||||
module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x';
|
module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x';
|
||||||
module.exports.WG_DEFAULT_DNS = process.env.WG_DEFAULT_DNS || '1.1.1.1';
|
module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string'
|
||||||
|
? process.env.WG_DEFAULT_DNS
|
||||||
|
: '1.1.1.1';
|
||||||
module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0';
|
module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0';
|
||||||
|
@ -51,6 +51,7 @@ module.exports = class WireGuard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.__saveConfig(config);
|
await this.__saveConfig(config);
|
||||||
|
await Util.exec('wg-quick down wg0').catch(() => {});
|
||||||
await Util.exec('wg-quick up wg0');
|
await Util.exec('wg-quick up wg0');
|
||||||
await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o eth0 -j MASQUERADE`);
|
await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o eth0 -j MASQUERADE`);
|
||||||
await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT');
|
await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT');
|
||||||
@ -174,7 +175,7 @@ AllowedIPs = ${client.address}/32`;
|
|||||||
[Interface]
|
[Interface]
|
||||||
PrivateKey = ${client.privateKey}
|
PrivateKey = ${client.privateKey}
|
||||||
Address = ${client.address}/24
|
Address = ${client.address}/24
|
||||||
DNS = ${WG_DEFAULT_DNS}
|
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''}
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = ${config.server.publicKey}
|
PublicKey = ${config.server.publicKey}
|
||||||
|
Loading…
Reference in New Issue
Block a user