|
|
|
@ -26,7 +26,6 @@ type IOCountersStat struct {
|
|
|
|
|
Dropout uint64 `json:"dropout"` // total number of outgoing packets which were dropped (always 0 on OSX and BSD)
|
|
|
|
|
Fifoin uint64 `json:"fifoin"` // total number of FIFO buffers errors while receiving
|
|
|
|
|
Fifoout uint64 `json:"fifoout"` // total number of FIFO buffers errors while sending
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Addr is implemented compatibility to psutil
|
|
|
|
@ -58,6 +57,7 @@ type InterfaceAddr struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type InterfaceStat struct {
|
|
|
|
|
Index int `json:"index"`
|
|
|
|
|
MTU int `json:"mtu"` // maximum transmission unit
|
|
|
|
|
Name string `json:"name"` // e.g., "en0", "lo0", "eth0.100"
|
|
|
|
|
HardwareAddr string `json:"hardwareaddr"` // IEEE MAC-48, EUI-48 and EUI-64 form
|
|
|
|
@ -121,6 +121,7 @@ func InterfacesWithContext(ctx context.Context) ([]InterfaceStat, error) {
|
|
|
|
|
for _, ifi := range is {
|
|
|
|
|
|
|
|
|
|
var flags []string
|
|
|
|
|
|
|
|
|
|
if ifi.Flags&net.FlagUp != 0 {
|
|
|
|
|
flags = append(flags, "up")
|
|
|
|
|
}
|
|
|
|
@ -138,6 +139,7 @@ func InterfacesWithContext(ctx context.Context) ([]InterfaceStat, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r := InterfaceStat{
|
|
|
|
|
Index: ifi.Index,
|
|
|
|
|
Name: ifi.Name,
|
|
|
|
|
MTU: ifi.MTU,
|
|
|
|
|
HardwareAddr: ifi.HardwareAddr.String(),
|
|
|
|
|