Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
v03413 committed Jun 21, 2022
1 parent 182326d commit 66c5b5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions client/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,35 @@ func (c *Client) getTraffic(ret *update) {

var inters = []string{
"lo",
"eth",
"tun",
"docker",
"veth",
"br-",
"vmbr",
"vnet",
"kube",
"ip_",
}

for _, info := range items {
for _, v := range inters {
if !strings.Contains(info.Name, v) {
continue
var contains = func(s string, subStr []string) bool {
for _, v := range subStr {
if strings.Contains(s, v) {

return true
}
}

return false
}

for _, info := range items {
if contains(info.Name, inters) {

data.in += info.BytesRecv
data.out += info.BytesSent
continue
}

data.in += info.BytesRecv
data.out += info.BytesSent
}

ret.NetWorkIn = data.in
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"time"
)

const Version = 0.13
const Version = 0.14
const DefaultServer = "127.0.0.1"
const DefaultPort = 35601
const DefaultInterval = 1
Expand Down

0 comments on commit 66c5b5e

Please sign in to comment.