159 Commits (v3.24.5)

Author SHA1 Message Date
camcui 3ec3f55280 chore: fix some typos in comments
Signed-off-by: camcui <cuishua@sina.cn>
Amarinder Cheema 6311a849df
Update net_openbsd.go to correctly parse netstat output on obsd. See #1441
Ville Skyttä 362fa4b9c4 Avoid repeated regexp compilations
Matthieu MOREL c806740b34
ci(lint): ensure io/ioutil replacement (#1525)
* ci(lint): enure ioutil replacement

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update host_solaris.go
* Update process_linux_test.go
* Update net_linux_test.go
* Update net_linux_test.go
* Update process_test.go
* Update process_linux_test.go
* Update process_linux_test.go

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
shirou 0665cafa1b chore: replace deprecated ioutil package to os and io
Antoine Toulme fe1caf758c lint fixes
Antoine Toulme 38b94668ea allow to pass context values to override environment variables
cui fliter 9aa4e7a744 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
Matthieu MOREL 1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
shirou 852f455217 fix lint
Steve Zhang cf62eac8f9 The current codes miss below statistic data under solaris/illumos:
1. the disk io statistic data as: nread, nwritten, reads, writes, rtime, wtime;
2. the free memory under global zone;
3. the net io statistic data as: rbytes64, ipackets64, idrops64, ierrors, obytes64, opackets64, odrops64, oerrors.

The new feature branch adds the above missing statistic data based on the psutil project (https://psutil.readthedocs.io/), it has been tested under solaris ( Oracle Solaris 11.4 X86) and illumos (OmniOS v11 r151044).
Steffen Geissinger 5bbcabf17d Pass on context to ConnectionsPidWithContext
Ties de Wit e4409ef6a1
Update net_linux.go
shirou f11e3ba120 fix(net,linux): move IsLittleEndian to internal
shirou e4e6ed2efa fix(net,linux): fix BigEndian test
shirou 8ae3affce0 fix(net,linux): fix decodeaddress if Big Endian
chbuescher 7dd96685cb
Merge branch 'shirou:master' into master
xca1075 d4f012c565 fix aix nocgo compile
xca1075 e24e72062b aix: split code, that uses perfstat, to _cgo and _nocgo files
shirou 0074fab5f5 [net][linux]: fix lint
xca1075 ce49e45ed3 get IOCounters for aix with perfstat
Ville Skyttä 7befb75528 [net] gofumpt with 0.3.0 / golangci-lint 1.45.0
Ville Skyttä f7e1f36418 refactor: remove unnecessary exec.LookPath calls
Executing the command does the lookup if needed and returns the same
error when not found, no need to do it separately.
Matthieu MOREL b0469a470b
Merge branch 'master' into master
Ville Skyttä 1e56c6f421 Spelling and grammar fixes
Matthieu MOREL 8ba220d241 enable contextcheck linter
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
mmorel-35 1e6b445a8a gofumpt
mmorel-35 eb5f6203d8 gofmt
Matthieu MOREL b673968d5d
enable errorlint linter
shirou d2e27c1712 fix dependabot v2 deletion.
shirou 0969c9436b delete v2 directory, move v3 to top #1078
shirou 3d97fc18f4 add check if it runs on CI
shirou c6bd05a3e9 relax net/NetIOCountersAll test.
It often fails in CI.
MashaSamoylova 7631bb0e5e Fix lsof args for udp4 in unix
shirou 34412e0b7f [net] relax NetIOCounterAll test
shirou 6286bea32a
Merge pull request #989 from Lomanic/issue734tests
[ci] Implement automatic tests on GH Actions on linux, windows and darwin
Lomanic 64e16cc8c3 [net][darwin] Fix tests with mismatched types
Lomanic 7f0ba43398 [net][darwin][freebsd] Fix tests with func not returning common.ErrNotImplementedError
MashaSamoylova 860f332c22 Fix getting udp6 ports
shirou f377a07e5a fix test and openbsd errors.
Sergey Vinogradov 8ff2ab3187 Add "vet" target to the Makefile
Making the "vet" target will run "go vet ./..." for each supported
GOOS.

Also, some of the warnings produced by go 1.15 vet were mitigated.
Lomanic 4cfc60d68b
Merge pull request #928 from Lomanic/skip-tests-when-not-implemented
Lomanic e1925b853e
Merge pull request #935 from Lomanic/issue900
[linux] Fix #900, skip or fix failing tests in docker
Lomanic 1b3e0c6643 [linux] Fix #900, skip or fix failing tests in docker
TestGetProcInodesAll: create a server so there are some opened inodes
TestUsers: skip if Users is empty, because of an empty /var/run/utmp
Test_Process_Groups: skip if Groups is empty
TestConnectionsMax: skip on CI, not only CircleCI
Lomanic ab084b525c [net] Skip tests on non-implemented platforms #446
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.
gtosh4 936d3b27f1
Don't ignore context for io counters
shirou 53cec6b37e
Merge pull request #839 from tklauser/move-parse-funcs
net: move parseNetLine and parseNetAddr to net_unix.go
Tobias Klauser 22d8ee41e5 net: move parseNetLine and parseNetAddr to net_unix.go
These funcs are only used in net_unix.go which is only compiled for
darwin and freebsd.