This script addresses an issue where WireGuard peers fail to re-resolve the domain of their endpoint when the IP address changes.
This script was created to address this limitation by:
- Checking the last handshake time: If the last handshake is older than a specified threshold (150 seconds in this case), the script triggers a re-resolution of the domain.
- Re-resolving the domain: It extracts the domain and port from the WireGuard peer configuration and forces WireGuard to update the peer's endpoint with the new resolved IP address.