tcpflow

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// FlowUnknown are unknown flow.
	FlowUnknown FlowDirection = 1 << iota
	// FlowActive are 'active open'.
	FlowActive
	// FlowPassive are 'passive open'
	FlowPassive

	FilterAll     = "all"
	FilterPublic  = "public"
	FilterPrivate = "private"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrPort

type AddrPort struct {
	Name string `json:"name"`
	Addr string `json:"addr"`
	Port string `json:"port"`
}

AddrPort are <addr>:<port>

func (*AddrPort) PortInt added in v0.4.0

func (a *AddrPort) PortInt() int

PortInt returnts integer representation.

func (*AddrPort) String

func (a *AddrPort) String() string

String returns the string representation of the AddrPort.

type FlowDirection

type FlowDirection int

FlowDirection are bitmask that represents both Active or Passive.

func (FlowDirection) MarshalJSON added in v0.2.0

func (c FlowDirection) MarshalJSON() ([]byte, error)

MarshalJSON returns human readable `mode` format.

func (FlowDirection) String added in v0.3.0

func (c FlowDirection) String() string

String returns string representation.

type GetHostFlowsOption added in v0.5.4

type GetHostFlowsOption struct {
	Numeric   bool
	Processes bool
	Filter    string
}

GetHostFlowsOption represens an option for func GetHostFlows().

type HostFlow

type HostFlow struct {
	Direction   FlowDirection `json:"direction"`
	Local       *AddrPort     `json:"local"`
	Peer        *AddrPort     `json:"peer"`
	Connections int64         `json:"connections"`
	Process     *Process      `json:"process,omitempty"`
}

HostFlow represents a `host flow`.

func (*HostFlow) String

func (f *HostFlow) String() string

String returns the string representation of HostFlow.

func (*HostFlow) UniqKey

func (f *HostFlow) UniqKey() string

UniqKey returns the unique identifier key for connections flow.

type HostFlows

type HostFlows map[string]*HostFlow

HostFlows represents a group of host flow by unique key.

func GetHostFlows

func GetHostFlows(opt *GetHostFlowsOption) (HostFlows, error)

GetHostFlows gets host flows by netlink, and try to get by procfs if it fails.

func GetHostFlowsByNetlink(opt *GetHostFlowsOption) (HostFlows, error)

GetHostFlowsByNetlink gets host flows by Linux netlink API.

func GetHostFlowsByProcfs added in v0.4.2

func GetHostFlowsByProcfs() (HostFlows, error)

GetHostFlowsByProcfs gets host flows from procfs.

func (HostFlows) MarshalJSON added in v0.2.0

func (hf HostFlows) MarshalJSON() ([]byte, error)

MarshalJSON converts map into list.

type Process added in v0.5.4

type Process struct {
	Name string `json:"name"`
	Pgid int    `json:"pgid"`
}

Process represents a OS process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL