Files
OneOS1.2/vite-plugins/utils/httpUtils.ts
王冕 7ef8852919 Initial commit: OneOS prototype workspace baseline.
Include weekly report and other prototype sources with project tooling config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 15:36:52 +08:00

16 lines
337 B
TypeScript

import { networkInterfaces } from 'node:os';
export function getLocalIP(): string {
const interfaces = networkInterfaces();
for (const nets of Object.values(interfaces)) {
for (const net of nets || []) {
if (net.family === 'IPv4' && !net.internal) {
return net.address;
}
}
}
return 'localhost';
}