Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
a6fb5813
Commit
a6fb5813
authored
Jun 18, 2016
by
Jeromy Johnson
Committed by
GitHub
Jun 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2867 from ipfs/feature/api-offline
Add way to check if node is online or offline
parents
2a3bba3a
c10ed855
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
core/commands/sysdiag.go
core/commands/sysdiag.go
+8
-2
test/sharness/t0151-sysdiag.sh
test/sharness/t0151-sysdiag.sh
+2
-1
No files found.
core/commands/sysdiag.go
View file @
a6fb5813
...
...
@@ -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
}
test/sharness/t0151-sysdiag.sh
View file @
a6fb5813
...
...
@@ -17,7 +17,8 @@ test_expect_success "ipfs diag sys succeeds" '
test_expect_success
"output contains some expected keys"
'
grep "virt" output &&
grep "interface_addresses" output &&
grep "arch" output
grep "arch" output &&
grep "online" output
'
test_expect_success
"uname succeeds"
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment