make ipv4 and ipv6 settings separate

This commit is contained in:
Girish Ramakrishnan
2022-02-15 12:31:55 -08:00
parent 0dbe8ee8f2
commit c6da8c8167
14 changed files with 102 additions and 68 deletions

View File

@@ -20,8 +20,7 @@ async function sync(auditSource) {
assert.strictEqual(typeof auditSource, 'object');
const ipv4 = await sysinfo.getServerIPv4();
const ipv6Enabled = await settings.getIPv6Config();
const ipv6 = ipv6Enabled ? await sysinfo.getServerIPv6() : null;
const ipv6 = await sysinfo.getServerIPv6();
const info = safe.JSON.parse(safe.fs.readFileSync(paths.DYNDNS_INFO_FILE, 'utf8')) || { ipv4: null, ipv6: null };
if (info.ip) { // legacy cache file
@@ -29,7 +28,7 @@ async function sync(auditSource) {
delete info.ip;
}
const ipv4Changed = info.ip !== ipv4;
const ipv6Changed = ipv6Enabled && info.ipv6 !== ipv6; // both should be RFC 5952 format
const ipv6Changed = ipv6 && info.ipv6 !== ipv6; // both should be RFC 5952 format
if (!ipv4Changed && !ipv6Changed) {
debug(`refreshDNS: no change in IP ipv4: ${ipv4} ipv6: ${ipv6}`);