Commit Graph

87 Commits (39cf619b04c39c03080f2efc94afa0d59522e9b2)

Author SHA1 Message Date
Matthieu MOREL e4e5f38eee chore: enable var-naming from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
6 days ago
Matthieu MOREL f4247f1c01 chore: enable unnecessary-stmt from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 week ago
Matthieu MOREL 30aff030d0 chore(golangci-lint): GOOS and GOARCH matrix
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
3 weeks ago
shirou 29ccada537 refactor(net): Gather base functions to net.go 3 months ago
Matthieu MOREL 7e19b35f50 enable all rules of perfsprint linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
3 months ago
shirou 37f531010d fix golangcilint errors, ignore gosec G115 7 months ago
shirou 5f158096be fix: golangci lint with max -> maxConn 7 months ago
shirou 5cd488ff30 [net][linux]: remove unused files. go1.11 is not supported now. 10 months ago
shirou bc060cc227 add SPDX License, remove old build tag, and replace import 10 months ago
camcui 3ec3f55280 chore: fix some typos in comments
Signed-off-by: camcui <cuishua@sina.cn>
11 months ago
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io 2 years ago
Antoine Toulme 38b94668ea allow to pass context values to override environment variables 2 years ago
cui fliter 9aa4e7a744 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2 years ago
Ties de Wit e4409ef6a1
Update net_linux.go 3 years ago
shirou f11e3ba120 fix(net,linux): move IsLittleEndian to internal 3 years ago
shirou 8ae3affce0 fix(net,linux): fix decodeaddress if Big Endian 3 years ago
Matthieu MOREL b0469a470b
Merge branch 'master' into master 3 years ago
Ville Skyttä 1e56c6f421 Spelling and grammar fixes 3 years ago
Matthieu MOREL 8ba220d241 enable contextcheck linter 3 years ago
Lomanic d826e14e27 [net][linux] Fix #1198 "f.ReadDir undefined" on Go 1.15 by redefining a custom readDir according to go version
Using os.File.Readdir pre Go 1.16 and os.File.ReadDir post Go 1.16
3 years ago
mmorel-35 1e6b445a8a gofumpt 3 years ago
Matthieu MOREL b673968d5d
enable errorlint linter 3 years ago
shirou d2e27c1712 fix dependabot v2 deletion. 3 years ago
shirou 0969c9436b delete v2 directory, move v3 to top #1078 3 years ago
Disconnect3d 5c1a9e709d net_linux.go: decode port as 16-bit uint
Changes the port parsing from `/proc/net/*` files records from parsing them as 64-bit integers to parse them as 16-bit unsigned integers.

While this is mostly a cosmetic change, it will also make so that the code fails faster in case the entry is malformed (for whatever reason).

Note that the returned value is still casted to uint32 when an  `Addr` object is created.
It seems to me that the `Addr.port` field should be changed to `uint16` but maybe some other APIs/systems wants it to be `uint32` and also changing it there may require changes in users code if they update. This being said I am not changing that field's type.
5 years ago
gtosh4 936d3b27f1
Don't ignore context for io counters 5 years ago
Brian C. Williams f00df5cffe Add WithoutUids funcs 5 years ago
Lomanic 6a8ab0308e [net][linux] Go fmt net/net_linux.go 6 years ago
chi-chi weng 809306b78a
Fix the net.ConnectionsMax BUG
`connectionsList, err := net.ConnectionsMax("tcp4", 1000)`
when you run net.ConnectionsMax,you will find some proc is not equal with the `netstat -lptn`
6 years ago
Curtis Mattoon 648bf4eebc Adds ConntrackStats to get conntrack summary stats 6 years ago
Joe Stringer f87d9813da [net][linux] Support socket tables in nested namespaces
Signed-off-by: Joe Stringer <joe@cilium.io>
6 years ago
Iskander Sharipov 3684fce88a net: use multi-value case clause instead of fallthrough
Found using https://go-critic.github.io/overview#emptyFallthrough-ref
7 years ago
shirou 4c73494c78 Add WithContext functions. 7 years ago
Daniel Nelson 6abd227e48
[net] linux: skip if not exist error on getProcInodesAll 7 years ago
shirou e01a14e318 [net] linux: skip if permission error on getProcInodesAll
This fixes #433
8 years ago
WAKAYAMA Shirou 09e9859714 [net]linux: return err. 8 years ago
better88 86af477d1a err omit in getProcInodes 8 years ago
Alexander Blagoev b32353f094 Add comments with a short explanation and link to the PR request 8 years ago
Alexander Blagoev 531f9507d2 Read /proc/net files with a single read syscall.
The /proc/net files are not guaranteed to be consistent, they are only
consitent on the row level. This is probably one of the reasons why
consequent read calls might return duplicate entries - the kernel is
changing the file as it is being read. In certain situations this might
lead to loop like situations - the same net entry is being returned when
reading the file as new connections are added to the kernel tcp table, i.e
there can be a lot of duplications.

This commit is trying to reduce the duplications, by fetching the contents
of the net files with a single read syscall.
8 years ago
shirou c251591dc7 Merge pull request #355 from sean-/fix-lint-errors
Fix lint errors
8 years ago
shirou 9af92986dd Merge pull request #358 from ablagoev/optimize-net-connections
Fromat socketType properly in tcp duplication check key
8 years ago
Alexander Blagoev 5a0a97f400 Fromat socketType properly in tcp duplication check key 8 years ago
shirou b066db40c7 Merge pull request #356 from ablagoev/optimize-net-connections
Optimize memory usage for net.Connections on Linux
8 years ago
Alexander Blagoev 11e78812ae Build duplicate tcp connection ID in Connections for better readbility 8 years ago
Alexander Blagoev f7dd4f97c7 Improve /proc/net/dev parsing to include all edge cases 8 years ago
Alexander Blagoev 51e4fb77cf Add socket state to TCP connection key 8 years ago
Alexander Blagoev daaadd4f1e Optimize memory usage for net.Connections on Linux 8 years ago
Sean Chittenden 23a4ae3369
`gofmt -s -w .` 8 years ago
Toshi Piazza 5e1c2fa23b Fixes memory leak 8 years ago
Peter De Cleyn e8fc31359b Added support to alias interfaces (e.g., ifname0:1) 8 years ago