What you're looking for is the IPv6 scope: "web reachable" are addresses in the global scope. The scopes are described here:
http://en.wikipedia.org/wiki/IPv6_address#IPv6_address_scopes
You could parse the address yourself -- OR you could save yourself some time and use the ipv6 module (npm install ipv6 --save
):
var v6 = require('ipv6').v6;
var addr = new v6.Address('2001:db8:85a3:8d3:1319:8a2e:370:7348');
if(addr.getScope()==='Global'){
console.log('valid global ipv6 address');
}
Disclaimer: I don't really know that much about IPv6...but I'm figuring it out. I found this discussion of the different scopes useful, by the way: