sysinfo: add interface to get IPv6 address

This commit is contained in:
Girish Ramakrishnan
2022-01-05 18:07:36 -08:00
parent 235d18cbb1
commit bbf1a5af3d
13 changed files with 100 additions and 32 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ function injectPrivateFields(newConfig, currentConfig) {
async function getQuery(dnsConfig) {
assert.strictEqual(typeof dnsConfig, 'object');
const ip = await sysinfo.getServerIp();
const ip = await sysinfo.getServerIPv4();
return {
ApiUser: dnsConfig.username,
+1 -1
View File
@@ -87,7 +87,7 @@ async function verifyDnsConfig(domainObject) {
if (error2 && error2.code === 'ENOTFOUND') throw new BoxError(BoxError.BAD_FIELD, `Unable to resolve ${fqdn}`, { field: 'nameservers' });
if (error2 || !result) throw new BoxError(BoxError.BAD_FIELD, error2 ? error2.message : `Unable to resolve ${fqdn}`, { field: 'nameservers' });
const [error3, ip] = await safe(sysinfo.getServerIp());
const [error3, ip] = await safe(sysinfo.getServerIPv4());
if (error3) throw new BoxError(BoxError.EXTERNAL_ERROR, `Failed to detect IP of this server: ${error3.message}`);
if (result.length !== 1 || ip !== result[0]) throw new BoxError(BoxError.EXTERNAL_ERROR, `Domain resolves to ${JSON.stringify(result)} instead of ${ip}`);