From 50518238052a6c6f91d7e66ac413541c78ce5565 Mon Sep 17 00:00:00 2001 From: phistuck Date: Tue, 27 Jan 2015 10:04:49 +0200 Subject: [PATCH] Identified all of the private IP addresses Converted indexOf matchings to a single regular expression and added support for 172.16 - 31.x.x. --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index df13a34..9271b21 100644 --- a/index.html +++ b/index.html @@ -79,8 +79,8 @@ var li = document.createElement("li"); li.textContent = ip; - //local IPs (TODO: 172.16.0.0/12) - if(ip.indexOf("10.") === 0 || ip.indexOf("192.168.") === 0) + //local IPs + if (ip.match(/^(192\.168\.|10\.|172\.(1[6-9]|2\d|3[01]))/)) document.getElementsByTagName("ul")[0].appendChild(li); //assume the rest are public IPs