This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require(process.cwd() + '/app'); | |
var winston = require('winston'); | |
var _ = require('lodash'); | |
// Set up logger | |
var customColors = { | |
trace: 'white', | |
debug: 'green', | |
info: 'green', | |
warn: 'yellow', |
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.