Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore virtual network switches (fixes issue #761) #763

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
@@ -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
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;
}
}
};