mirror of
https://github.com/luscis/openlan.git
synced 2025-10-04 08:16:29 +08:00
14 lines
238 B
Go
Executable File
14 lines
238 B
Go
Executable File
package models
|
|
|
|
import (
|
|
nl "github.com/vishvananda/netlink"
|
|
)
|
|
|
|
func (l *Output) Update() {
|
|
if link, err := nl.LinkByName(l.Device); err == nil {
|
|
sts := link.Attrs().Statistics
|
|
l.RxBytes = sts.RxBytes
|
|
l.TxBytes = sts.TxBytes
|
|
}
|
|
}
|