pubface 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -5
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const fetchUrl = require('nodemailer/lib/fetch');
|
|
4
4
|
const packageData = require('./package.json');
|
|
5
5
|
const dns = require('dns').promises;
|
|
6
6
|
const os = require('os');
|
|
@@ -101,9 +101,15 @@ function getPublicInterfaces() {
|
|
|
101
101
|
let publicInterfaces = { IPv4: [], IPv6: [] };
|
|
102
102
|
Object.keys(interfaces)
|
|
103
103
|
.flatMap(iface => interfaces[iface].filter(entry => !entry.internal).map(entry => Object.assign({ iface }, entry)))
|
|
104
|
-
.forEach(
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
.forEach(originalEntry => {
|
|
105
|
+
let entry = Object.assign({}, originalEntry);
|
|
106
|
+
|
|
107
|
+
let family = typeof entry.family === 'number' ? `IPv${entry.family}` : entry.family;
|
|
108
|
+
if (entry.family !== family) {
|
|
109
|
+
entry.family = family;
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(publicInterfaces[family])) {
|
|
112
|
+
publicInterfaces[family].push(entry);
|
|
107
113
|
}
|
|
108
114
|
});
|
|
109
115
|
return publicInterfaces;
|
|
@@ -124,10 +130,12 @@ async function timedFunction(prom, timeout, localAddress) {
|
|
|
124
130
|
|
|
125
131
|
async function resolveIP(localAddress, family) {
|
|
126
132
|
let data = await new Promise((resolve, reject) => {
|
|
127
|
-
let req =
|
|
133
|
+
let req = fetchUrl(RESOLV_URL, {
|
|
128
134
|
userAgent: `${packageData.name}/${packageData.version}`,
|
|
129
135
|
tls: {
|
|
130
136
|
host: DNS_CACHE[family] && DNS_CACHE[family].host,
|
|
137
|
+
servername: new URL(RESOLV_URL).hostname,
|
|
138
|
+
hostname: new URL(RESOLV_URL).hostname,
|
|
131
139
|
rejectUnauthorized: false,
|
|
132
140
|
localAddress
|
|
133
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pubface",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Resolve public network interfaces for current machine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"ipaddr.js": "2.0.1",
|
|
22
|
-
"nodemailer": "6.
|
|
22
|
+
"nodemailer": "6.8.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"pkg": "5.
|
|
25
|
+
"pkg": "5.8.0"
|
|
26
26
|
},
|
|
27
27
|
"pkg": {
|
|
28
28
|
"assets": [
|