Skip to content

Commit

Permalink
v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Jun 7, 2022
1 parent 7045b33 commit cf51508
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const fetch = require('nodemailer/lib/fetch');
const fetchUrl = require('nodemailer/lib/fetch');
const packageData = require('./package.json');
const dns = require('dns').promises;
const os = require('os');
Expand Down Expand Up @@ -101,9 +101,15 @@ function getPublicInterfaces() {
let publicInterfaces = { IPv4: [], IPv6: [] };
Object.keys(interfaces)
.flatMap(iface => interfaces[iface].filter(entry => !entry.internal).map(entry => Object.assign({ iface }, entry)))
.forEach(entry => {
if (Array.isArray(publicInterfaces[entry.family])) {
publicInterfaces[entry.family].push(entry);
.forEach(originalEntry => {
let entry = Object.assign({}, originalEntry);

let family = typeof entry.family === 'number' ? `IPv${entry.family}` : entry.family;
if (entry.family !== family) {
entry.family = family;
}
if (Array.isArray(publicInterfaces[family])) {
publicInterfaces[family].push(entry);
}
});
return publicInterfaces;
Expand All @@ -124,7 +130,7 @@ async function timedFunction(prom, timeout, localAddress) {

async function resolveIP(localAddress, family) {
let data = await new Promise((resolve, reject) => {
let req = fetch(RESOLV_URL, {
let req = fetchUrl(RESOLV_URL, {
userAgent: `${packageData.name}/${packageData.version}`,
tls: {
host: DNS_CACHE[family] && DNS_CACHE[family].host,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pubface",
"version": "1.0.2",
"version": "1.0.3",
"description": "Resolve public network interfaces for current machine",
"main": "index.js",
"scripts": {
Expand All @@ -19,10 +19,10 @@
},
"dependencies": {
"ipaddr.js": "2.0.1",
"nodemailer": "6.7.1"
"nodemailer": "6.7.5"
},
"devDependencies": {
"pkg": "5.4.1"
"pkg": "5.7.0"
},
"pkg": {
"assets": [
Expand Down

0 comments on commit cf51508

Please sign in to comment.