apidump

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpPacketCounters added in v0.13.0

func DumpPacketCounters(logf func(f string, args ...interface{}), interfaces map[string]interfaceInfo, matchedSummary *trace.PacketCounter, unmatchedSummary *trace.PacketCounter, showInterface bool)

DumpPacketCounters prints the accumulated packet counts per interface and per port, to the logging function specified in the first argument. The "interfaces" argument should be the map keyed by interface names (as created in the apidump.Run function); all we really need are those names.

func GetErrorType added in v0.21.18

func GetErrorType(err error) api_schema.ApidumpErrorType

Returns the error type if err contains an ApidumpError, or ApidumpError_Other otherwise.

func GetErrorTypeWithDefault added in v0.21.18

func GetErrorTypeWithDefault(err error, def api_schema.ApidumpErrorType) api_schema.ApidumpErrorType

Returns the error type if err contains an ApidumpError, or def otherwise.

func Run

func Run(args Args) error

Captures packets from the network and adds them to a trace. The trace is created if it doesn't already exist.

Types

type ApidumpError added in v0.21.18

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

func NewApidumpError added in v0.21.18

func NewApidumpError(errType api_schema.ApidumpErrorType, msg string) ApidumpError

func NewApidumpErrorf added in v0.21.18

func NewApidumpErrorf(errType api_schema.ApidumpErrorType, format string, args ...interface{}) ApidumpError

func (ApidumpError) Error added in v0.21.18

func (e ApidumpError) Error() string

type Args

type Args struct {
	// Required args
	ClientID akid.ClientID
	Domain   string

	// If both LocalPath and AkitaURI are set, data is teed to both local traces
	// and backend trace.
	// If unset, defaults to a random spec name on Akita Cloud.
	Out location.Location

	// Args used to using agent with Postman
	PostmanCollectionID string

	Interfaces     []string
	Filter         string
	Tags           map[tags.Key]string
	PathExclusions []string
	HostExclusions []string
	PathAllowlist  []string
	HostAllowlist  []string

	// Rate-limiting parameters -- only one should be set to a non-default value.
	SampleRate         float64
	WitnessesPerMinute float64

	// If set, apidump will run the command in a subshell and terminate
	// automatically when the subcommand terminates.
	//
	// apidump will pipe stdout and stderr from the command. If the command stops
	// with non-zero exit code, apidump will also exit with the same exit code.
	ExecCommand string

	// Username to run ExecCommand as. If not set, defaults to the current user.
	ExecCommandUser string

	Plugins []plugin.AkitaPlugin

	// How often to rotate learn sessions; set to zero to disable rotation.
	LearnSessionLifetime time.Duration

	// Deployment tag value; may come from an environment variable
	Deployment string

	// Print packet capture statistics after N seconds.
	StatsLogDelay int

	// Periodically report telemetry every N seconds thereafter
	TelemetryInterval int

	// Periodically poll /proc fs for agent resource usage every N seconds.
	ProcFSPollingInterval int

	// Whether to report TCP connections and TLS handshakes.
	CollectTCPAndTLSReports bool

	// Parse TLS handshake messages (even if not reported)
	// Invariant: this is true if CollectTCPAndTLSReports is true
	ParseTLSHandshakes bool

	// The maximum witness size to upload. Anything larger is dropped.
	MaxWitnessSize_bytes int

	// Whether to run the command with additional functionality to support the Docker Extension
	DockerExtensionMode bool
	// The port to be used by the Docker Extension for health checks
	HealthCheckPort int
}

type Summary added in v0.21.0

type Summary struct {
	// Indicates whether this summary includes information about packets that did
	// not meet the BPF filters specified by the user.
	CapturingNegation bool

	Interfaces      map[string]interfaceInfo
	NegationFilters map[string]string
	NumUserFilters  int

	// Values that change over the course of apidump are pointers.
	FilterSummary    *trace.PacketCounter
	PrefilterSummary *trace.PacketCounter
	NegationSummary  *trace.PacketCounter
}

Captures apidump progress.

func NewSummary added in v0.21.0

func NewSummary(
	capturingNegation bool,
	interfaces map[string]interfaceInfo,
	negationFilters map[string]string,
	numUserFilters int,
	filterSummary *trace.PacketCounter,
	prefilterSummary *trace.PacketCounter,
	negationSummary *trace.PacketCounter,
) *Summary

func (*Summary) IsEmpty added in v0.21.0

func (s *Summary) IsEmpty() bool

Returns true if the trace generated from this apidump will be empty.

func (*Summary) PrintPacketCountHighlights added in v0.21.13

func (s *Summary) PrintPacketCountHighlights()

Summarize the top sources of traffic seen in a log-friendly format. This appears before PrintWarnings, and should highlight the raw data.

func (*Summary) PrintPacketCounts added in v0.21.0

func (s *Summary) PrintPacketCounts()

Dumps packet counters for packets captured and sent to the Akita backend. If the debug flag is set, also prints packets taht were captured but not sent to the backend.

func (*Summary) PrintWarnings added in v0.21.0

func (s *Summary) PrintWarnings()

Prints warnings based on packet capture behavior, such as not capturing any packets, capturing packets but failing to parse them, etc.

Jump to

Keyboard shortcuts

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