From 7aa865bd25ecb8170e78dc096f9032703041d431 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 2 Oct 2021 20:42:20 +0800 Subject: [PATCH] u --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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