external: minor.
This commit is contained in:
parent
15ba37099e
commit
278265536e
@ -35,12 +35,11 @@ external.getIPv4 = async function getIPv4() {
|
||||
return await external.getIPv42();
|
||||
}
|
||||
|
||||
ip = res.body.trim();
|
||||
|
||||
try {
|
||||
ip = res.body.trim();
|
||||
ip = IP.toBuffer(ip);
|
||||
|
||||
if (!IP.isMapped(ip))
|
||||
if (!IP.isIPv4(ip))
|
||||
throw new Error('Could not find IPv4.');
|
||||
|
||||
ip = IP.toString(ip);
|
||||
@ -76,7 +75,7 @@ external.getIPv42 = async function getIPv42() {
|
||||
ip = match[1];
|
||||
raw = IP.toBuffer(ip);
|
||||
|
||||
if (!IP.isMapped(raw))
|
||||
if (!IP.isIPv4(raw))
|
||||
throw new Error('Could not find IPv4.');
|
||||
|
||||
return IP.toString(raw);
|
||||
@ -101,7 +100,7 @@ external.getIPv6 = async function getIPv6() {
|
||||
ip = res.body.trim();
|
||||
ip = IP.toBuffer(ip);
|
||||
|
||||
if (IP.isMapped(ip))
|
||||
if (!IP.isIPv6(ip))
|
||||
throw new Error('Could not find IPv6.');
|
||||
|
||||
return IP.toString(ip);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user