pubface 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.js +11 -5
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const fetch = require('nodemailer/lib/fetch');
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(entry => {
105
- if (Array.isArray(publicInterfaces[entry.family])) {
106
- publicInterfaces[entry.family].push(entry);
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,7 +130,7 @@ 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 = fetch(RESOLV_URL, {
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubface",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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.7.1"
22
+ "nodemailer": "6.7.5"
23
23
  },
24
24
  "devDependencies": {
25
- "pkg": "5.4.1"
25
+ "pkg": "5.7.0"
26
26
  },
27
27
  "pkg": {
28
28
  "assets": [