net

package
v0.0.0-...-cedfd68 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Overview

Package net provides local access to system probe

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotImplemented is an error used when system-probe is attempted to be accessed on an unsupported OS
	ErrNotImplemented = errors.New("system-probe unsupported")
)

Functions

func CheckPath

func CheckPath(path string) error

CheckPath is used in conjunction with calling the stats endpoint, since we are calling this From the main agent and want to ensure the socket exists

Types

type Conn

type Conn interface {
	// GetListener returns the underlying net.Listener
	GetListener() net.Listener

	// Stop and clean up resources for the underlying connection
	Stop()
}

Conn is a wrapper over some net.Listener

type RemoteSysProbeUtil

type RemoteSysProbeUtil struct {
	// contains filtered or unexported fields
}

RemoteSysProbeUtil wraps interactions with a remote system probe service

func (*RemoteSysProbeUtil) DetectLanguage

func (r *RemoteSysProbeUtil) DetectLanguage(pids []int32) ([]languagemodels.Language, error)

func (*RemoteSysProbeUtil) GetBTFLoaderInfo

func (r *RemoteSysProbeUtil) GetBTFLoaderInfo() ([]byte, error)

GetBTFLoaderInfo queries ebpf_btf_loader_info to get information about where btf files came from

func (*RemoteSysProbeUtil) GetConnTrackCached

func (r *RemoteSysProbeUtil) GetConnTrackCached() ([]byte, error)

GetConnTrackCached queries conntrack/cached, which uses our conntracker implementation (typically ebpf) to return the list of NAT'd connections

func (*RemoteSysProbeUtil) GetConnTrackHost

func (r *RemoteSysProbeUtil) GetConnTrackHost() ([]byte, error)

GetConnTrackHost queries conntrack/host, which uses netlink to return the list of NAT'd connections

func (*RemoteSysProbeUtil) GetConnections

func (r *RemoteSysProbeUtil) GetConnections(clientID string) (*model.Connections, error)

GetConnections returns a set of active network connections, retrieved from the system probe service

func (*RemoteSysProbeUtil) GetDiscoveryServices

func (r *RemoteSysProbeUtil) GetDiscoveryServices() (*discoverymodel.ServicesResponse, error)

GetDiscoveryServices returns service information from system-probe.

func (*RemoteSysProbeUtil) GetNetworkID

func (r *RemoteSysProbeUtil) GetNetworkID() (string, error)

GetNetworkID fetches the network_id (vpc_id) from system-probe

func (*RemoteSysProbeUtil) GetPing

func (r *RemoteSysProbeUtil) GetPing(clientID string, host string, count int, interval time.Duration, timeout time.Duration) ([]byte, error)

GetPing returns the results of a ping to a host

func (*RemoteSysProbeUtil) GetPprof

func (r *RemoteSysProbeUtil) GetPprof(path string) ([]byte, error)

GetPprof queries the pprof endpoint for system-probe

func (*RemoteSysProbeUtil) GetProcStats added in v0.9.0

func (r *RemoteSysProbeUtil) GetProcStats(pids []int32) (*model.ProcStatsWithPermByPID, error)

GetProcStats returns a set of process stats by querying system-probe

func (*RemoteSysProbeUtil) GetStats

func (r *RemoteSysProbeUtil) GetStats() (map[string]interface{}, error)

GetStats returns the expvar stats of the system probe

func (*RemoteSysProbeUtil) GetTelemetry

func (r *RemoteSysProbeUtil) GetTelemetry() ([]byte, error)

GetTelemetry queries the telemetry endpoint from system-probe.

func (*RemoteSysProbeUtil) GetTraceroute

func (r *RemoteSysProbeUtil) GetTraceroute(clientID string, host string, port uint16, protocol nppayload.Protocol, maxTTL uint8, timeout time.Duration) ([]byte, error)

GetTraceroute returns the results of a traceroute to a host

func (*RemoteSysProbeUtil) Register

func (r *RemoteSysProbeUtil) Register(clientID string) error

Register registers the client to system probe

type SysProbeUtil

type SysProbeUtil interface {
	GetConnections(clientID string) (*model.Connections, error)
	GetStats() (map[string]interface{}, error)
	GetProcStats(pids []int32) (*model.ProcStatsWithPermByPID, error)
	Register(clientID string) error
	GetNetworkID() (string, error)
	GetTelemetry() ([]byte, error)
	GetConnTrackCached() ([]byte, error)
	GetConnTrackHost() ([]byte, error)
	GetBTFLoaderInfo() ([]byte, error)
	DetectLanguage(pids []int32) ([]languagemodels.Language, error)
	GetPprof(path string) ([]byte, error)
	GetDiscoveryServices() (*discoverymodel.ServicesResponse, error)
	GetPing(clientID string, host string, count int, interval time.Duration, timeout time.Duration) ([]byte, error)
	GetTraceroute(clientID string, host string, port uint16, protocol nppayload.Protocol, maxTTL uint8, timeout time.Duration) ([]byte, error)
}

SysProbeUtil fetches info from the SysProbe running remotely

func GetRemoteSystemProbeUtil

func GetRemoteSystemProbeUtil(path string) (SysProbeUtil, error)

GetRemoteSystemProbeUtil returns a ready to use RemoteSysProbeUtil. It is backed by a shared singleton.

type SysProbeUtilGetter

type SysProbeUtilGetter func(string) (SysProbeUtil, error)

SysProbeUtilGetter is a function that returns a SysProbeUtil for the given path The standard implementation is GetRemoteSysProbeUtil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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