replace ipaddr.js

This commit is contained in:
Girish Ramakrishnan
2025-05-06 16:16:33 +02:00
parent c8976daf96
commit a7c6e36ec3
10 changed files with 186 additions and 34 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ const apps = require('./apps.js'),
dashboard = require('./dashboard.js'),
debug = require('debug')('box:dns'),
domains = require('./domains.js'),
ipaddr = require('ipaddr.js'),
ipaddr = require('./ipaddr.js'),
mail = require('./mail.js'),
mailServer = require('./mailserver.js'),
network = require('./network.js'),
@@ -141,7 +141,7 @@ async function checkDnsRecords(subdomain, domain) {
const ipv6Records = await getDnsRecords(subdomain, domain, 'AAAA');
// if empty OR exactly one record with the ip, we don't need to overwrite
if (ipv6Records.length !== 0 && (ipv6Records.length !== 1 || ipaddr.parse(ipv6Records[0]).toRFC5952String() !== ipv6)) return { needsOverwrite: true };
if (ipv6Records.length !== 0 && (ipv6Records.length !== 1 || !ipaddr.isEqual(ipv6Records[0], ipv6))) return { needsOverwrite: true };
}
return { needsOverwrite: false }; // one record exists and in sync