Documentation ¶
Index ¶
- Variables
- func EnterNetNS(newNs, curNs netns.NsHandle) (func(), error)
- func GetReadableState(state uint8) string
- func IsSystemdCgroupPath(containerdCgroupPath string) (segments []string, isSystemdCgroupStyle bool)
- type ConnectionState
- type ConnectionStatistics
- type Container
- type ContainerDriver
- type ContainerFilter
- type ContainerdDriver
- type Options
- type OptionsFunc
- type TCPState
- type TCPStates
- type TCPStatistics
- type Tracker
- func (t *Tracker) GetConnectionState(container Container) (*ConnectionState, error)
- func (t *Tracker) GetConnectionStatistics(container Container) (*ConnectionStatistics, error)
- func (t *Tracker) ListAllConnectionState(ctx context.Context, filter ContainerFilter) ([]ConnectionState, error)
- func (t *Tracker) ListAllConnectionStatistics(ctx context.Context, filter ContainerFilter) ([]ConnectionStatistics, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func EnterNetNS ¶ added in v0.1.11
EnterNetNS sets execution of the code following this call to the network namespace newNs, then moves the thread back to curNs if open, otherwise to the current netns at the time the function was invoked In case of success, the caller is expected to execute the returned function at the end of the code that needs to be executed in the network namespace. Example:
func jobAt(...) error { d, err := EnterNetNS(...) if err != nil { return err} defer d() < code which needs to be executed in specific netns> }
Shadow from netns package
func GetReadableState ¶
func IsSystemdCgroupPath ¶ added in v0.1.9
Types ¶
type ConnectionState ¶
type ConnectionStatistics ¶ added in v0.1.3
type ConnectionStatistics struct { Container NetNSID string IPv4 TCPStatistics IPv6 TCPStatistics }
type ContainerDriver ¶
type ContainerFilter ¶ added in v0.1.6
Return false if wanna bypass
type ContainerdDriver ¶
type ContainerdDriver struct {
// contains filtered or unexported fields
}
func NewContainerdDriver ¶
func NewContainerdDriver(client *containerd.Client, opts ...OptionsFunc) (*ContainerdDriver, error)
func (*ContainerdDriver) ListContainer ¶
func (d *ContainerdDriver) ListContainer(ctx context.Context) ([]Container, error)
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
type OptionsFunc ¶
func WithEnvCollectionFilter ¶
func WithEnvCollectionFilter(filter func(string) bool) OptionsFunc
func WithFixedCgroupRoot ¶
func WithFixedCgroupRoot(path string) OptionsFunc
type TCPStatistics ¶ added in v0.1.3
type TCPStatistics struct {
// contains filtered or unexported fields
}
func NewTCPStatistics ¶ added in v0.1.7
func NewTCPStatistics() *TCPStatistics
func (TCPStatistics) AllocatedPortCount ¶ added in v0.1.7
func (s TCPStatistics) AllocatedPortCount() int
func (TCPStatistics) CountByState ¶ added in v0.1.7
func (s TCPStatistics) CountByState() map[uint8]uint64
func (*TCPStatistics) Record ¶ added in v0.1.7
func (s *TCPStatistics) Record(socket *netlink.Socket)
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
func NewTracker ¶
func NewTracker(driver ContainerDriver, families []uint8) (*Tracker, error)
func (*Tracker) GetConnectionState ¶
func (t *Tracker) GetConnectionState(container Container) (*ConnectionState, error)
func (*Tracker) GetConnectionStatistics ¶ added in v0.1.3
func (t *Tracker) GetConnectionStatistics(container Container) (*ConnectionStatistics, error)
func (*Tracker) ListAllConnectionState ¶
func (t *Tracker) ListAllConnectionState(ctx context.Context, filter ContainerFilter) ([]ConnectionState, error)
func (*Tracker) ListAllConnectionStatistics ¶ added in v0.1.3
func (t *Tracker) ListAllConnectionStatistics(ctx context.Context, filter ContainerFilter) ([]ConnectionStatistics, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.