ip: minor.

This commit is contained in:
Christopher Jeffrey 2017-07-31 14:34:29 -07:00
parent e38da91065
commit 34421c1653
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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) {