Commit Graph

112 Commits

Author SHA1 Message Date
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
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`
2019-06-12 11:37:08 +08:00
Lomanic 658804ae70
Merge pull request #697 from Lomanic/issue693
[net][windows] Fix #693 use MIB_IF_ROW2/GetIfEntry2 to get real uint64 values from win32 API
2019-06-03 19:43:32 +02:00
Lomanic 3fb9243fc2 [net][windows] Fix #693 use MIB_IF_ROW2/GetIfEntry2 to get real uint64 values from win32 API 2019-05-31 17:39:23 +02:00
Curtis Mattoon 648bf4eebc Adds ConntrackStats to get conntrack summary stats 2019-05-11 12:45:05 -04:00
Segflow 86c7289ccc Fix: use filename in exec.LookPath instead of full path
exec.LookPath searches for the file in the $PATH, which mean giving it an absolute path is against it's own purposes.
2019-05-05 20:45:07 +01:00
mingrammer 017c9f9cbc Fix typos 2019-03-18 02:52:26 +09:00
Joe Stringer f87d9813da [net][linux] Support socket tables in nested namespaces
Signed-off-by: Joe Stringer <joe@cilium.io>
2018-11-27 10:16:31 -08:00
Iskander Sharipov 3684fce88a net: use multi-value case clause instead of fallthrough
Found using https://go-critic.github.io/overview#emptyFallthrough-ref
2018-09-13 23:52:36 +03:00
Lomanic eb1f1ab16f
Merge pull request #549 from pytimer/win_net
[net] Implements windows net package Connections and ConnectionsPid
2018-09-01 15:42:34 +02:00
Lomanic ef54649286 [windows] Use windows.NewLazySystemDLL to (possibly) prevent DLL hijacking
Might be useless because of https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
but better be safe than sorry.

Ref: https://github.com/shirou/gopsutil/issues/570#issuecomment-413951653
2018-08-18 22:52:41 +02:00
pytimer 0ffcfc901f [net][windows] Remove exported types and convert ALL_CAPS to mixedCaps 2018-07-21 14:28:53 +08:00
pytimer 1c2cebbbc4 [net] Implements windows net package function Connections and ConnectionsPid 2018-07-21 14:21:22 +08:00
Kamil Dziedzic b76d065dff
PMM-2643: Support listing unix sockets in ConnectionsPid and ConnectionsPidWithContext.
Signed-off-by: Kamil Dziedzic <arvenil@klecza.pl>
2018-07-03 16:57:21 +02:00
Michal Rostecki 9d003ad2e1 net: Check for error object 2018-06-21 17:00:15 +02:00
shirou 145dca90f7 change to use CommandContext. 2018-03-31 21:35:53 +09:00
Laurie Clark-Michalek 413cb32b6c Use static initialisation for invoke instances, instead of init funcs
The order of init function execution is dependant on the order that the
source files are passed to the compiler. This causes issues when
building under other build systems, such as bazel or buck, as they are
not guarenteed to maintain the same file order as the default go tool.
2018-03-21 14:08:39 +00:00
shirou 4c73494c78 Add WithContext functions. 2017-12-31 15:25:49 +09:00
Daniel Nelson 6abd227e48
[net] linux: skip if not exist error on getProcInodesAll 2017-11-17 10:46:16 -08:00
Marco Pfatschbacher df6462b50e Fix PR comments made by shirou 2017-11-09 13:14:12 +01:00
Marco Pfatschbacher 6e7aca41d7 Implement Connection support for OpenBSD
This retrieves open TCP/UDP connections by using netstat(1)
File descriptors and pids are not supported.
2017-11-08 21:26:05 +01:00
shirou e01a14e318 [net] linux: skip if permission error on getProcInodesAll
This fixes #433
2017-10-07 11:42:26 +09:00
WAKAYAMA Shirou 09e9859714 [net]linux: return err. 2017-07-10 16:48:47 +09:00
better88 86af477d1a err omit in getProcInodes 2017-07-10 15:03:52 +08:00
Sean Chittenden 635b971c0e
Move from the `syscall` package to the `golang.org/x/sys/{unix,windows}` 2017-06-02 13:51:00 -07:00
Alexander Blagoev b32353f094 Add comments with a short explanation and link to the PR request 2017-05-04 14:52:34 +03:00
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.
2017-05-01 20:59:02 +03:00
shirou c251591dc7 Merge pull request #355 from sean-/fix-lint-errors
Fix lint errors
2017-05-01 22:28:17 +09:00
shirou 9af92986dd Merge pull request #358 from ablagoev/optimize-net-connections
Fromat socketType properly in tcp duplication check key
2017-04-30 23:39:46 +09:00
Alexander Blagoev 5a0a97f400 Fromat socketType properly in tcp duplication check key 2017-04-30 16:55:03 +03:00
shirou b066db40c7 Merge pull request #356 from ablagoev/optimize-net-connections
Optimize memory usage for net.Connections on Linux
2017-04-30 20:22:54 +09:00
Alexander Blagoev 11e78812ae Build duplicate tcp connection ID in Connections for better readbility 2017-04-30 14:19:54 +03:00
Alexander Blagoev f7dd4f97c7 Improve /proc/net/dev parsing to include all edge cases 2017-04-29 18:57:54 +03:00
Alexander Blagoev 51e4fb77cf Add socket state to TCP connection key 2017-04-28 19:34:08 +03:00
Alexander Blagoev daaadd4f1e Optimize memory usage for net.Connections on Linux 2017-04-28 19:00:28 +03:00
Sean Chittenden 23a4ae3369
`gofmt -s -w .` 2017-04-27 14:40:43 -07:00
Sean Chittenden d0e40ff723
Fix issues reported by golint. 2017-04-27 14:21:34 -07:00
Toshi Piazza 5e1c2fa23b Fixes memory leak 2017-02-22 02:53:45 -05:00
Peter De Cleyn e8fc31359b Added support to alias interfaces (e.g., ifname0:1) 2017-02-21 08:19:22 +01:00
Cameron Sparr a213bf5e6d
run go fmt ./... 2017-02-01 23:05:29 +00:00
Conor Branagan 276c873f0d Fast duplication check in inodes processing.
Instead of encoding a JSON string of each connection (non-trivial at high
connection volumes) we can use the connTmp struct for map look-ups if we
eliminate the unused `uids` field.

Also switches to using the empty struct instead of bool for zero memory
overhead.
2016-12-20 12:38:54 -05:00
WAKAYAMA Shirou 42156fdf0d [net]linux: fix NetFilterCounters filename 2016-12-20 23:59:53 +09:00