diff --git a/README.md b/README.md index 026cc2f..5610ade 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ These options can be configured by setting environment variables using `-e KEY=" | `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. | | `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server. | | `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. WireGuard will always listen on `51820` inside the Docker container. | +| `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. | | `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. | | `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | | `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. | diff --git a/docker-compose.yml b/docker-compose.yml index 601ccf9..0a13acc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,7 @@ services: # - WG_PORT=51820 # - WG_DEFAULT_ADDRESS=10.8.0.x # - WG_DEFAULT_DNS=1.1.1.1 + # - WG_MTU=1420 # - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24 image: weejewel/wg-easy diff --git a/src/config.js b/src/config.js index d9cf5af..9811c90 100644 --- a/src/config.js +++ b/src/config.js @@ -8,6 +8,7 @@ module.exports.PASSWORD = process.env.PASSWORD; module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/'; module.exports.WG_HOST = process.env.WG_HOST; module.exports.WG_PORT = process.env.WG_PORT || 51820; +module.exports.WG_MTU = process.env.WG_MTU || null; module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || 0; module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x'; module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string' diff --git a/src/lib/WireGuard.js b/src/lib/WireGuard.js index 3722273..0f11ebe 100644 --- a/src/lib/WireGuard.js +++ b/src/lib/WireGuard.js @@ -14,6 +14,7 @@ const { WG_PATH, WG_HOST, WG_PORT, + WG_MTU, WG_DEFAULT_DNS, WG_DEFAULT_ADDRESS, WG_PERSISTENT_KEEPALIVE, @@ -191,6 +192,9 @@ AllowedIPs = ${client.address}/32`; PrivateKey = ${client.privateKey} Address = ${client.address}/24 ${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}` : ''} +if (typeof ${WG_MTU} !== 'undefined' || ${WG_MTU} !== null) { +MTU = ${WG_MTU} +} [Peer] PublicKey = ${config.server.publicKey}