Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 591ed9c

Browse files
Merge pull request #39 from andreiamatuni/master
add a shell function for the diag net command
2 parents 49d8bc4 + 99d9c07 commit 591ed9c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

shell.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,3 +676,24 @@ func (s *Shell) ObjectPut(obj *IpfsObject) (string, error) {
676676

677677
return out.Hash, nil
678678
}
679+
680+
func (s *Shell) DiagNet(format string) ([]byte, error) {
681+
var result = new(bytes.Buffer)
682+
683+
req := s.newRequest("diag/net")
684+
req.Opts["vis"] = format
685+
686+
resp, err := req.Send(s.httpcli)
687+
if err != nil {
688+
return []byte{}, err
689+
}
690+
691+
defer resp.Close()
692+
if resp.Error != nil {
693+
return []byte{}, resp.Error
694+
}
695+
696+
result.ReadFrom(resp.Output)
697+
698+
return result.Bytes(), nil
699+
}

0 commit comments

Comments
 (0)