Skip to content

Commit

Permalink
Ignore virtual network switches (fixes issue vercel#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivanmatthew authored Apr 16, 2023
1 parent 155b412 commit 29d710d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serve",
"version": "14.2.0",
"version": "14.2.1",
"description": "Static file serving and directory listing",
"keywords": [
"vercel",
Expand Down
7 changes: 5 additions & 2 deletions source/utilities/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ export const registerCloseListener = (fn: () => void): void => {
* @returns The address of the host.
*/
export const getNetworkAddress = (): string | undefined => {
for (const interfaceDetails of Object.values(networkInterfaces)) {
for (const name of Object.keys(networkInterfaces)) {
const interfaceDetails = networkInterfaces[name];

if (!interfaceDetails) continue;

for (const details of interfaceDetails) {
const { address, family, internal } = details;

if (family === 'IPv4' && !internal) return address;
if (family === 'IPv4' && !internal && !name.startsWith('vEthernet'))
return address;
}
}
};

0 comments on commit 29d710d

Please sign in to comment.