@@ -18,9 +18,9 @@ func netStats() (*NetStat, error) {
18
18
if err != nil {
19
19
return nil , err
20
20
}
21
- IO := make (map [string ][]int32 )
21
+ IO := make (map [string ][]uint64 )
22
22
for _ , IOStat := range netStats {
23
- nic := []int32 { int32 ( IOStat .BytesSent ), int32 ( IOStat .BytesRecv ) }
23
+ nic := []uint64 { IOStat .BytesSent , IOStat .BytesRecv }
24
24
IO [IOStat .Name ] = nic
25
25
}
26
26
if len (IO ) == 0 {
@@ -33,8 +33,8 @@ func netStats() (*NetStat, error) {
33
33
return nil , errors .New ("interface not found" )
34
34
}
35
35
allNet := IO ["all" ]
36
- currentBytesSent := uint64 ( allNet [0 ])
37
- currentBytesRecv := uint64 ( allNet [1 ])
36
+ currentBytesSent := allNet [0 ]
37
+ currentBytesRecv := allNet [1 ]
38
38
bytesSent := currentBytesSent - lastCurrentBytesSent
39
39
bytesRecv := currentBytesRecv - lastCurrentBytesRecv
40
40
lastCurrentBytesSent = currentBytesSent
@@ -52,7 +52,7 @@ func netStats() (*NetStat, error) {
52
52
bytesRecv = 0
53
53
}
54
54
return & NetStat {
55
- SentKB : uint64 ( bytesSent / 1024 ) ,
56
- RecvKB : uint64 ( bytesRecv / 1024 ) ,
55
+ SentKB : bytesSent / 1024 ,
56
+ RecvKB : bytesRecv / 1024 ,
57
57
}, nil
58
58
}
0 commit comments