Commit Graph

153 Commits

Author SHA1 Message Date
Antoine Toulme 38b94668ea allow to pass context values to override environment variables 2023-06-02 01:31:05 -07:00
cui fliter 9aa4e7a744 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-09 16:42:07 +08:00
Matthieu MOREL 1fb1e3e3e6 ci(lint): correct gci linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-04-04 18:07:22 +00:00
shirou 852f455217 fix lint 2023-02-12 09:24:52 +00:00
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).
2022-11-21 21:28:36 -07:00
Steffen Geissinger 5bbcabf17d Pass on context to ConnectionsPidWithContext 2022-10-19 10:07:21 +02:00
Ties de Wit e4409ef6a1
Update net_linux.go 2022-09-01 09:17:10 +02:00
shirou f11e3ba120 fix(net,linux): move IsLittleEndian to internal 2022-07-04 08:41:25 +00:00
shirou e4e6ed2efa fix(net,linux): fix BigEndian test 2022-07-03 02:44:35 +00:00
shirou 8ae3affce0 fix(net,linux): fix decodeaddress if Big Endian 2022-07-02 13:39:32 +00:00
chbuescher 7dd96685cb
Merge branch 'shirou:master' into master 2022-06-07 08:51:58 +02:00
xca1075 d4f012c565 fix aix nocgo compile 2022-06-03 17:43:52 +02:00
xca1075 e24e72062b aix: split code, that uses perfstat, to _cgo and _nocgo files 2022-06-03 17:01:36 +02:00
shirou 0074fab5f5 [net][linux]: fix lint 2022-05-21 09:31:25 +00:00
xca1075 ce49e45ed3 get IOCounters for aix with perfstat 2022-05-18 11:14:17 +02:00
Ville Skyttä 7befb75528 [net] gofumpt with 0.3.0 / golangci-lint 1.45.0 2022-03-19 22:43:20 +02:00
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.
2022-03-04 18:56:33 +02:00
Matthieu MOREL b0469a470b
Merge branch 'master' into master 2022-02-01 19:28:26 +01:00
Ville Skyttä 1e56c6f421 Spelling and grammar fixes 2022-01-30 22:48:09 +02:00
Matthieu MOREL 8ba220d241 enable contextcheck linter 2022-01-24 09:26:50 +01:00
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
2022-01-01 18:07:03 +01:00
mmorel-35 1e6b445a8a gofumpt 2021-12-22 21:54:41 +00:00
mmorel-35 eb5f6203d8 gofmt 2021-12-22 21:46:33 +00:00
Matthieu MOREL b673968d5d
enable errorlint linter 2021-12-04 22:29:38 +01:00
shirou d2e27c1712 fix dependabot v2 deletion. 2021-12-01 00:12:55 +00:00
shirou 0969c9436b delete v2 directory, move v3 to top #1078 2021-11-30 23:47:59 +00:00
shirou 3d97fc18f4 add check if it runs on CI 2021-05-08 22:31:05 +09:00
shirou c6bd05a3e9 relax net/NetIOCountersAll test.
It often fails in CI.
2021-05-08 21:25:16 +09:00
MashaSamoylova 7631bb0e5e Fix lsof args for udp4 in unix 2021-01-11 17:08:18 +07:00
shirou 34412e0b7f [net] relax NetIOCounterAll test 2020-11-19 22:24:36 +09:00
shirou 6286bea32a
Merge pull request #989 from Lomanic/issue734tests
[ci] Implement automatic tests on GH Actions on linux, windows and darwin
2020-11-19 21:46:19 +09:00
Lomanic 64e16cc8c3 [net][darwin] Fix tests with mismatched types 2020-11-08 17:13:56 +01:00
Lomanic 7f0ba43398 [net][darwin][freebsd] Fix tests with func not returning common.ErrNotImplementedError 2020-11-08 17:13:56 +01:00
MashaSamoylova 860f332c22 Fix getting udp6 ports 2020-11-04 09:32:02 +07:00
shirou f377a07e5a fix test and openbsd errors. 2020-10-25 19:06:59 +09:00
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.
2020-10-10 16:50:49 +03:00
Lomanic 4cfc60d68b
Merge pull request #928 from Lomanic/skip-tests-when-not-implemented 2020-09-06 13:33:31 +02:00
Lomanic e1925b853e
Merge pull request #935 from Lomanic/issue900
[linux] Fix #900, skip or fix failing tests in docker
2020-09-02 10:35:27 +02:00
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
2020-09-02 01:06:17 +02:00
Lomanic ab084b525c [net] Skip tests on non-implemented platforms #446 2020-08-29 18:39:50 +02:00
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.
2020-08-28 00:31:50 +02:00
gtosh4 936d3b27f1
Don't ignore context for io counters 2020-05-16 17:06:26 -07:00
shirou 53cec6b37e
Merge pull request #839 from tklauser/move-parse-funcs
net: move parseNetLine and parseNetAddr to net_unix.go
2020-03-14 22:36:25 +09:00
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.
2020-02-25 10:05:37 +01:00
Clément Chigot 77ff16c081 net: add AIX support 2020-02-10 11:22:52 +01:00
Brian C. Williams f00df5cffe Add WithoutUids funcs 2019-11-01 10:58:35 -04:00
Snow Fox 018950cf06
Merge pull request #2 from shirou/master
merge master
2019-07-18 15:26:30 +08:00
litong 1f9466536e Add ifIndex support 2019-07-18 15:21:21 +08:00
litong 7ffe40e0db Add ifIndex support 2019-07-18 15:12:45 +08:00
Lomanic 6a8ab0308e [net][linux] Go fmt net/net_linux.go 2019-07-11 00:33:41 +02:00