说明
使用 chrome.system.network
API。
权限
system.network
类型
NetworkInterface
属性
-
地址
string
可用的 IPv4/6 地址。
-
name
string
适配器的基础名称。在 *nix 上,该名称通常为“eth0”“wlan0”等。
-
prefixLength
number
前缀长度
方法
getNetworkInterfaces()
Promise
chrome.system.network.getNetworkInterfaces(
callback?: function,
)
检索有关此系统上本地适配器的信息。
参数
-
callback
函数(可选)
callback
参数如下所示:(networkInterfaces: NetworkInterface[]) => void
-
networkInterfaces
包含网络接口信息的对象数组。
-
返回
-
Promise<NetworkInterface[]>
Chrome 91 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。