fold sysinfo into network
the backends are network backends
This commit is contained in:
+3
-3
@@ -15,8 +15,8 @@ const assert = require('assert'),
|
||||
debug = require('debug')('box:dns/manual'),
|
||||
dig = require('../dig.js'),
|
||||
dns = require('../dns.js'),
|
||||
network = require('../network.js'),
|
||||
safe = require('safetydance'),
|
||||
sysinfo = require('../sysinfo.js'),
|
||||
waitForDns = require('./waitfordns.js');
|
||||
|
||||
function removePrivateFields(domainObject) {
|
||||
@@ -84,10 +84,10 @@ async function verifyDomainConfig(domainObject) {
|
||||
if (ipv4Error) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}: ${ipv4Error.message}`);
|
||||
if (!ipv4Result) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv4 of ${fqdn}`);
|
||||
|
||||
const ipv4 = await sysinfo.getServerIPv4();
|
||||
const ipv4 = await network.getIPv4();
|
||||
if (ipv4Result.length !== 1 || ipv4 !== ipv4Result[0]) throw new BoxError(BoxError.EXTERNAL_ERROR, `Domain resolves to ${JSON.stringify(ipv4Result)} instead of IPv4 ${ipv4}`);
|
||||
|
||||
const ipv6 = await sysinfo.getServerIPv6(); // both should be RFC 5952 format
|
||||
const ipv6 = await network.getIPv6(); // both should be RFC 5952 format
|
||||
if (ipv6) {
|
||||
const [ipv6Error, ipv6Result] = await safe(dig.resolve(fqdn, 'AAAA', { server: '127.0.0.1', timeout: 5000 }));
|
||||
if (ipv6Error && (ipv6Error.code === 'ENOTFOUND' || ipv6Error.code === 'ENODATA')) throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve IPv6 of ${fqdn}`);
|
||||
|
||||
Reference in New Issue
Block a user