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

Commit fa6ec75

Browse files
committed
add a shell function for the diag net command
1 parent 49d8bc4 commit fa6ec75

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

shell.go

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

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

0 commit comments

Comments
 (0)