net_fallback.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //go:build !aix && !darwin && !linux && !freebsd && !openbsd && !windows
  2. // +build !aix,!darwin,!linux,!freebsd,!openbsd,!windows
  3. package net
  4. import (
  5. "context"
  6. "github.com/shirou/gopsutil/v3/internal/common"
  7. )
  8. func IOCounters(pernic bool) ([]IOCountersStat, error) {
  9. return IOCountersWithContext(context.Background(), pernic)
  10. }
  11. func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat, error) {
  12. return []IOCountersStat{}, common.ErrNotImplementedError
  13. }
  14. func FilterCounters() ([]FilterStat, error) {
  15. return FilterCountersWithContext(context.Background())
  16. }
  17. func FilterCountersWithContext(ctx context.Context) ([]FilterStat, error) {
  18. return []FilterStat{}, common.ErrNotImplementedError
  19. }
  20. func ConntrackStats(percpu bool) ([]ConntrackStat, error) {
  21. return ConntrackStatsWithContext(context.Background(), percpu)
  22. }
  23. func ConntrackStatsWithContext(ctx context.Context, percpu bool) ([]ConntrackStat, error) {
  24. return nil, common.ErrNotImplementedError
  25. }
  26. func ProtoCounters(protocols []string) ([]ProtoCountersStat, error) {
  27. return ProtoCountersWithContext(context.Background(), protocols)
  28. }
  29. func ProtoCountersWithContext(ctx context.Context, protocols []string) ([]ProtoCountersStat, error) {
  30. return []ProtoCountersStat{}, common.ErrNotImplementedError
  31. }
  32. func Connections(kind string) ([]ConnectionStat, error) {
  33. return ConnectionsWithContext(context.Background(), kind)
  34. }
  35. func ConnectionsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
  36. return []ConnectionStat{}, common.ErrNotImplementedError
  37. }
  38. func ConnectionsMax(kind string, max int) ([]ConnectionStat, error) {
  39. return ConnectionsMaxWithContext(context.Background(), kind, max)
  40. }
  41. func ConnectionsMaxWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) {
  42. return []ConnectionStat{}, common.ErrNotImplementedError
  43. }
  44. // Return a list of network connections opened, omitting `Uids`.
  45. // WithoutUids functions are reliant on implementation details. They may be altered to be an alias for Connections or be
  46. // removed from the API in the future.
  47. func ConnectionsWithoutUids(kind string) ([]ConnectionStat, error) {
  48. return ConnectionsWithoutUidsWithContext(context.Background(), kind)
  49. }
  50. func ConnectionsWithoutUidsWithContext(ctx context.Context, kind string) ([]ConnectionStat, error) {
  51. return ConnectionsMaxWithoutUidsWithContext(ctx, kind, 0)
  52. }
  53. func ConnectionsMaxWithoutUidsWithContext(ctx context.Context, kind string, max int) ([]ConnectionStat, error) {
  54. return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, 0, max)
  55. }
  56. func ConnectionsPidWithoutUids(kind string, pid int32) ([]ConnectionStat, error) {
  57. return ConnectionsPidWithoutUidsWithContext(context.Background(), kind, pid)
  58. }
  59. func ConnectionsPidWithoutUidsWithContext(ctx context.Context, kind string, pid int32) ([]ConnectionStat, error) {
  60. return ConnectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, 0)
  61. }
  62. func ConnectionsPidMaxWithoutUids(kind string, pid int32, max int) ([]ConnectionStat, error) {
  63. return ConnectionsPidMaxWithoutUidsWithContext(context.Background(), kind, pid, max)
  64. }
  65. func ConnectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) {
  66. return connectionsPidMaxWithoutUidsWithContext(ctx, kind, pid, max)
  67. }
  68. func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, pid int32, max int) ([]ConnectionStat, error) {
  69. return []ConnectionStat{}, common.ErrNotImplementedError
  70. }