Handle sparse files (fixes #245)

This commit is contained in:
Jakob Borg
2015-11-21 16:30:53 +01:00
parent f7ad97918a
commit d46f267663
6 changed files with 136 additions and 1 deletions

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
}