esp-ai
Version:
Provide a complete set of AI dialogue solutions for your development board, including but not limited to the IAT+LLM+TTS integration solution for the ESP32 series development board. | 为你的开发板提供全套的AI对话方案,包括但不限于 `ESP32` 系列开发板的 `IAT+LLM+TTS` 集成方案。
16 lines (15 loc) • 569 B
JavaScript
const os = require('os');
function getIPV4() {
// 获取网络接口
const networkInterfaces = os.networkInterfaces();
let ips = [];
// 遍历所有接口
Object.keys(networkInterfaces).forEach(interfaceName => {
networkInterfaces[interfaceName].forEach(interface => {
// 检查是否是 IPv4 地址,且不是内部地址(即不是 localhost)
(interface.family === 4 || interface.family === 'IPv4') && ips.push(interface.address)
});
});
return ips;
}
module.exports = getIPV4;