diff --git a/index.js b/index.js index 5b10bf9..399f853 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,11 @@ const dns = require('dns') const util = require('util') module.exports = { - dn2ip: async function (host) { + + /*---------------------------------------------------------------- + * Network tools + ----------------------------------------------------------------*/ + async dn2ip(host) { // domain name 2 ip if (typeof host === 'string' && host) { var ip = await util @@ -18,7 +22,7 @@ module.exports = { } return null }, - isPrivateIp: function (addr) { + isPrivateIp(addr) { return ( /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) || @@ -31,7 +35,7 @@ module.exports = { /^::$/.test(addr) ) }, - getMyIp: function () { + getMyIp() { var publicIp = null var privateIp = null var self = this