【发布时间】:2023-04-05 19:40:01
【问题描述】:
我想用 react 制作网络监控仪表板。我想做的是获取 LAN 设备的所有信息,并在 react 上显示它们,如 Net Analyzer 移动应用程序。但不是移动,使用 reactjs。 我可以使用一些节点模块访问一些简单的数据,但我无法在 react 上运行相同的代码。 我使用的节点模块和输出如下:
var network = require('network');
network.get_public_ip(function(err, ip) {
console.log(err || ip); // should return your public IP address
})
network.get_private_ip(function(err, ip) {
console.log(err || ip); // err may be 'No active network interface found'.
})
network.get_gateway_ip(function(err, ip) {
console.log(err || ip); // err may be 'No active network interface found.'
})
network.get_interfaces_list(function(err, list) {
list.forEach(item => console.log(item));
})
我使用的第二个模块
const find = require('local-devices');
find().then(devices => {
console.log(devices);
})
当我在 react 上使用这个模块时,我会遇到一些这样的错误。
我必须用react改进界面。我应该如何进行?最合乎逻辑的方法是什么?
【问题讨论】:
-
我怀疑那些需要做监控的api是否在浏览器中可用。
标签: javascript node.js reactjs lan network-monitoring