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

View File

@@ -16,7 +16,6 @@ const assert = require('assert'),
debug = require('debug')('box:dns/cloudflare'),
dig = require('../dig.js'),
dns = require('../dns.js'),
ipaddr = require('ipaddr.js'),
safe = require('safetydance'),
superagent = require('../superagent.js'),
waitForDns = require('./waitfordns.js'),
@@ -144,10 +143,8 @@ async function upsert(domainObject, location, type, values) {
};
if (i >= records.length) { // create a new record
// cloudflare will error if proxied is set for wrong record type or IP
if (type === 'A' || type === 'AAAA' || type === 'CNAME') {
const isUnicast = ipaddr.parse(value).range() === 'unicast';
data.proxied = isUnicast ? !!domainConfig.defaultProxyStatus : false; // only set at install time
data.proxied = !!domainConfig.defaultProxyStatus; // note that cloudflare will error if proxied is set for wrong record type or IP. only set at install time
}
debug(`upsert: Adding new record fqdn: ${fqdn}, zoneName: ${zoneName} proxied: ${data.proxied}`);