Package: node-ip / 1.1.5-3

0002-fix-private-public-logic Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Description: Faulty private/public logic returns wrong values
 This reverses the check in the filter method of ip.address(), as the definition of Array.prototype.filter() says "returns array of elements that pass the test".
 It is currently doing exactly the opposite.
Author: daniel@tschinder.de
Origin: other, https://github.com/indutny/node-ip/pull/61
Last-Update: 2018-05-12
Index: node-ip/lib/ip.js
===================================================================
--- node-ip.orig/lib/ip.js
+++ node-ip/lib/ip.js
@@ -389,8 +389,8 @@ ip.address = function(name, family) {
         return true;
       }
 
-      return name === 'public' ? ip.isPrivate(details.address) :
-          ip.isPublic(details.address);
+      return name === 'public' ? ip.isPublic(details.address) :
+          ip.isPrivate(details.address);
     });
 
     return addresses.length ? addresses[0].address : undefined;