- import { networkInterfaces } from "node:os";
- export default () => {
- const interfaces = networkInterfaces();
- for (const name of Object.keys(interfaces)) {
- if (!name.startsWith('wlan') && !name.startsWith('wlp')) continue
-
- for (const net of interfaces[name]) {
- if (net.family !== "IPv4" || net.internal) continue
-
- return net.address;
- }
- }
- }
|