This repository was archived by the owner on Feb 7, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ import (
2020 ma "github.com/multiformats/go-multiaddr"
2121 manet "github.com/multiformats/go-multiaddr-net"
2222 tar "github.com/whyrusleeping/tar-utils"
23+
24+ p2pmetrics "gx/ipfs/QmdeBtQGXjSt7cb97nx9JyLHHv5va2LyEAue7Q5tDFzpLy/go-libp2p-metrics"
2325)
2426
2527const (
@@ -850,3 +852,34 @@ func (s *Shell) ObjectStat(key string) (*ObjectStats, error) {
850852
851853 return stat , nil
852854}
855+
856+ // ObjectStat gets stats for the DAG object named by key. It returns
857+ // the stats of the requested Object or an error.
858+ func (s * Shell ) StatsBW () (* p2pmetrics.Stats , error ) {
859+ v := & p2pmetrics.Stats {}
860+ err := s .RequestDecode (context .TODO (), & v , "stats/bw" )
861+ return v , err
862+ }
863+
864+ type SwarmStreamInfo struct {
865+ Protocol string
866+ }
867+
868+ type SwarmConnInfo struct {
869+ Addr string
870+ Peer string
871+ Latency string
872+ Muxer string
873+ Streams []SwarmStreamInfo
874+ }
875+
876+ type SwarmConnInfos struct {
877+ Peers []SwarmConnInfo
878+ }
879+
880+ // SwarmPeers gets all the swarm peers
881+ func (s * Shell ) SwarmPeers () (* SwarmConnInfos , error ) {
882+ v := & SwarmConnInfos {}
883+ err := s .RequestDecode (context .TODO (), & v , "swarm/peers" )
884+ return v , err
885+ }
You can’t perform that action at this time.
0 commit comments