mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 19:07:48 +08:00
- Modified Godeps/Godeps.json by hand - [TEST] Updated welcome docs hash to sharness - [TEST] Updated contact doc - [TEST] disabled breaking test (t0080-repo refs local)
26 lines
417 B
Go
26 lines
417 B
Go
package bitswap
|
|
|
|
import (
|
|
u "github.com/ipfs/go-ipfs/util"
|
|
"sort"
|
|
)
|
|
|
|
type Stat struct {
|
|
ProvideBufLen int
|
|
Wantlist []u.Key
|
|
Peers []string
|
|
}
|
|
|
|
func (bs *Bitswap) Stat() (*Stat, error) {
|
|
st := new(Stat)
|
|
st.ProvideBufLen = len(bs.newBlocks)
|
|
st.Wantlist = bs.GetWantlist()
|
|
|
|
for _, p := range bs.engine.Peers() {
|
|
st.Peers = append(st.Peers, p.Pretty())
|
|
}
|
|
sort.Strings(st.Peers)
|
|
|
|
return st, nil
|
|
}
|