From 34421c1653a24a2fd8e932cf849e025d9dc3490c Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 31 Jul 2017 14:34:29 -0700 Subject: [PATCH] ip: minor. --- lib/utils/ip.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utils/ip.js b/lib/utils/ip.js index 37bcab97..2fe9cd4d 100644 --- a/lib/utils/ip.js +++ b/lib/utils/ip.js @@ -411,9 +411,8 @@ IP.toString = function toString(raw) { } if (raw.length === 16) { - let host = ''; - if (IP.isMapped(raw)) { + let host = ''; host += raw[12]; host += '.' + raw[13]; host += '.' + raw[14]; @@ -422,10 +421,12 @@ IP.toString = function toString(raw) { } if (IP.isOnion(raw)) { - host = base32.encode(raw.slice(6)); + const host = base32.encode(raw.slice(6)); return `${host}.onion`; } + let host = ''; + host += raw.readUInt16BE(0, true).toString(16); for (let i = 2; i < 16; i += 2) {