WireGuard DDNS
A lightweight tool that provides DDNS dynamic DNS support for WireGuard.
Features
- Auto-discover active WireGuard interfaces and check
wg-quickconfigurations; - Customizable DNS resolution check interval;
- Single interface mode - monitor specific WireGuard interface by name;
- API interface for triggering WireGuard interface restarts via webhook;
- Header-based API authentication;
- Swagger documentation support for API;
- Rich logging output with INFO, DEBUG levels;
- Environment variable support;
- Provide systemd service template;
- Package and deploy via Nix.
Parameters
--single-interface: Specify a single WireGuard interface to monitor. If not specified, auto-discovers all active interfaces;--listen-address: Listen address for API service, supports IPv4 and IPv6 addresses;--listen-port: Listen port for API service;--api-key: Authentication key for API service;--log-level: Log output level, options:debug,info,warn,error, default:info;--check-interval: DNS resolution check interval, supports time units likes,m,h, default:10s;--check-only: Check active WireGuard interfaces and exit (does not start monitoring);--version: Show version information;--help: Show help information.
Environment Variables
In addition to command line parameters, all configuration options support environment variables:
WG_DDNS_SINGLE_INTERFACE: Corresponds to--single-interfaceWG_DDNS_LISTEN_ADDRESS: Corresponds to--listen-addressWG_DDNS_LISTEN_PORT: Corresponds to--listen-portWG_DDNS_API_KEY: Corresponds to--api-keyWG_DDNS_LOG_LEVEL: Corresponds to--log-levelWG_DDNS_CHECK_INTERVAL: Corresponds to--check-interval
Note: Command line parameters take precedence over environment variables.
Installation
Nix Package Manager
With Nix package manager, you can easily install wg-ddns:
- Install from nixpkgs
nix profile install nixpkgs#wg-ddns
- Install from GitHub
nix profile install github:fernvenue/wg-ddns
- Build from Source
git clone https://github.com/fernvenue/wg-ddns.git
cd wg-ddns
nix build
./result/bin/wg-ddns --helpUsage Examples
- Auto-discover
- Specify interface
wg-ddns --single-interface wg0
- Set check interval
wg-ddns --check-interval 5m
- Enable debug logging
wg-ddns --log-level debug
- Enable API service
wg-ddns --listen-address "[::1]" --listen-port 8080 --api-key "your_api_key"
- Single interface mode with API service
wg-ddns --single-interface wg0 --listen-address "[::1]" --listen-port 8080 --api-key "your_api_key"
- Quick check of active interfaces
- Check specific interface
wg-ddns --check-only --single-interface wg0