Skip to content

Commit

Permalink
Add net.online to diag sys command
Browse files Browse the repository at this point in the history
Currently there was no sure way to check if node is in online
or offline mode.

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Jun 18, 2016
1 parent 2a3bba3 commit e67a21e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/commands/sysdiag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -130,6 +135,7 @@ func netInfo(out map[string]interface{}) error {
}

n["interface_addresses"] = straddrs
n["online"] = online
out["net"] = n
return nil
}

0 comments on commit e67a21e

Please sign in to comment.