u
This commit is contained in:
parent
37c18b75e0
commit
7aa865bd25
10
index.js
10
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
|
||||
|
Loading…
Reference in New Issue
Block a user