tracer

package
v0.0.0-...-6aee3ff Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDataLen = fmt.Errorf("invalid data length")

ErrInvalidDataLen indicates that the delivered frame had a invalid length

View Source
var ErrSkipPkg = fmt.Errorf("skipped packet")

ErrSkipPkg indicates that this packet should be skipped

View Source
var ErrUnsupportedProto = fmt.Errorf("unsupported l7 proto")

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type HTTPMetadata

type HTTPMetadata struct {
	Method string
	URI    string
	Proto  string
}

HTTPMetadata contains HTTP metadata

func (*HTTPMetadata) String

func (h *HTTPMetadata) String() string

type L3Proto

type L3Proto string
const (
	L3IPv4 L3Proto = "IPv4"
	L3IPv6 L3Proto = "IPv6"
)

type L4Proto

type L4Proto string
const (
	L4TCP L4Proto = "TCP"
	L4UDP L4Proto = "UDP"
)

type L7Metadata

type L7Metadata map[string]string

L7Metadata ..

func (L7Metadata) String

func (m L7Metadata) String() string

type L7Proto

type L7Proto string
const (
	L7HTTP    L7Proto = "HTTP"
	L7DNS     L7Proto = "DNS"
	L7Unknown L7Proto = "unknown"
)

type TraceEvent

type TraceEvent struct {
	Metadata   *TraceMetadata
	SourceAddr net.IP
	DestAddr   net.IP
	SourcePort uint16
	DestPort   uint16
	L3Proto    L3Proto
	L4Proto    L4Proto
	L7Proto    L7Proto
	L7Metadata L7Metadata
}

TraceEvent contains

func (*TraceEvent) String

func (t *TraceEvent) String() string

type TraceMetadata

type TraceMetadata struct {
	Ifname string
	SKBLen uint16
}

type Tracer

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

Tracer contains all the information to manage a eBPF trace program

func NewTracer

func NewTracer(ifacePrefix string, perfPollInterval, syncInterval time.Duration) (*Tracer, error)

NewTracer prepares a eBPF program and a perf event reader

func (*Tracer) Read

func (s *Tracer) Read() <-chan pb.Trace

Read returns a channel which outputs trace events

func (*Tracer) Start

func (s *Tracer) Start() error

Start starts reading from the perf event buffer, processes the packets and forwards them to outChan Start should be called only once

func (*Tracer) Stop

func (s *Tracer) Stop()

Stop stops the internal goroutine for reading from perf event buffer and resets the datapath eBPF programs

Jump to

Keyboard shortcuts

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