Skip to content

Commit

Permalink
chore: revert findIp
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdikhashan committed Aug 2, 2024
1 parent 7533bb5 commit 2e4e825
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ class Server {

/**
* @param {"v4" | "v6"} family
* @returns {Promise<string | undefined>}
* @returns {string | undefined}
*/
static async internalIP(family) {
static findIp(family) {
let host;
Object.values(os.networkInterfaces())
.flatMap((networks) => networks ?? [])
Expand All @@ -404,6 +404,18 @@ class Server {
return host;
}

/**
* @param {"v4" | "v6"} family
* @returns {string | undefined}
*/
static internalIP(family) {
try {
return Server.findIp(family);
} catch {
// ignore
}
}

/**
* @param {Host} hostname
* @returns {Promise<string>}
Expand Down

0 comments on commit 2e4e825

Please sign in to comment.