Fixes to getServerIPv6()

This commit is contained in:
Girish Ramakrishnan
2022-01-06 12:22:16 -08:00
parent cc61ee00be
commit 2bc5c3cb6e
4 changed files with 7 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ async function getServerIPv6(config) {
if (!iface) throw new BoxError(BoxError.NETWORK_ERROR, `No interface named ${config.ifname}`);
const addresses = iface.filter(i => i.family === 'IPv6').map(i => i.address);
if (addresses.length === 0) throw new BoxError(BoxError.NETWORK_ERROR, `${config.ifname} does not have any IPv4 address`);
if (addresses.length === 0) throw new BoxError(BoxError.NETWORK_ERROR, `${config.ifname} does not have any IPv6 address`);
if (addresses.length > 1) debug(`${config.ifname} has multiple ipv6 - ${JSON.stringify(addresses)}. choosing the first one.`);
return addresses[0];