From df61ef6d5f00add3f687c1d082d65293192ccad9 Mon Sep 17 00:00:00 2001 From: Conor Branagan Date: Sun, 11 Dec 2016 12:59:26 -0500 Subject: [PATCH] Add stub functions for ConnectionsMax in other OS versions. --- net/net_fallback.go | 4 ++++ net/net_unix.go | 11 +++++++++++ net/net_windows.go | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/net/net_fallback.go b/net/net_fallback.go index f4addb0..653bd47 100644 --- a/net/net_fallback.go +++ b/net/net_fallback.go @@ -19,3 +19,7 @@ func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) { func Connections(kind string) ([]ConnectionStat, error) { return []ConnectionStat{}, common.ErrNotImplementedError } + +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/net/net_unix.go b/net/net_unix.go index 45de6b1..1224128 100644 --- a/net/net_unix.go +++ b/net/net_unix.go @@ -13,6 +13,12 @@ func Connections(kind string) ([]ConnectionStat, error) { return ConnectionsPid(kind, 0) } +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + // Return a list of network connections opened by a process. func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { var ret []ConnectionStat @@ -66,3 +72,8 @@ func ConnectionsPid(kind string, pid int32) ([]ConnectionStat, error) { return ret, nil } + +// Return up to `max` network connections opened by a process. +func ConnectionsPidMax(kind string, pid int32, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} diff --git a/net/net_windows.go b/net/net_windows.go index 4d97c6e..996e832 100644 --- a/net/net_windows.go +++ b/net/net_windows.go @@ -76,6 +76,12 @@ func Connections(kind string) ([]ConnectionStat, error) { return ret, common.ErrNotImplementedError } +// Return a list of network connections opened returning at most `max` +// connections for each running process. +func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) { + return []ConnectionStat{}, common.ErrNotImplementedError +} + func FilterCounters() ([]FilterStat, error) { return nil, errors.New("NetFilterCounters not implemented for windows") }