Handle sparse files (fixes #245)

This commit is contained in:
Jakob Borg committed 2015-11-21 17:58:09 +01:00
1 parent f7ad97918a
commit d46f267663
6 files changed
+136 -1

No files matched your search

+24
View File
@@ -550,3 +550,27 @@ func (p *Process) eventLoop() {
}
}
}
type ConnectionStats struct {
Address string
Type string
Connected bool
Paused bool
ClientVersion string
InBytesTotal int64
OutBytesTotal int64
}
func (p *Process) Connections() (map[string]ConnectionStats, error) {
bs, err := p.Get("/rest/system/connections")
if err != nil {
return nil, err
}
var res map[string]ConnectionStats
if err := json.Unmarshal(bs, &res); err != nil {
return nil, err
}
return res, nil
}