提交 e67a21ed 作者: Jakub Sztandera

Add net.online to diag sys command

Currently there was no sure way to check if node is in online
or offline mode.

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 2a3bba3a
......@@ -44,8 +44,13 @@ Prints out information about your computer to aid in easier debugging.
res.SetError(err, cmds.ErrNormal)
return
}
node, err := req.InvocContext().GetNode()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
err = netInfo(info)
err = netInfo(node.OnlineMode(), info)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
......@@ -117,7 +122,7 @@ func memInfo(out map[string]interface{}) error {
return nil
}
func netInfo(out map[string]interface{}) error {
func netInfo(online bool, out map[string]interface{}) error {
n := make(map[string]interface{})
addrs, err := manet.InterfaceMultiaddrs()
if err != nil {
......@@ -130,6 +135,7 @@ func netInfo(out map[string]interface{}) error {
}
n["interface_addresses"] = straddrs
n["online"] = online
out["net"] = n
return nil
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论