ringbuf

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 12 Imported by: 123

Documentation

Overview

Package ringbuf allows interacting with Linux BPF ring buffer.

BPF allows submitting custom events to a BPF ring buffer map set up by userspace. This is very useful to push things like packet samples from BPF to a daemon running in user space.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed = errors.New("ringbuf reader was closed")
)

Functions

This section is empty.

Types

type Reader

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

Reader allows reading bpf_ringbuf_output from user space.

func NewReader

func NewReader(ringbufMap *ebpf.Map) (r *Reader, err error)

NewReader creates a new BPF ringbuf reader.

func (*Reader) Close

func (r *Reader) Close() error

Close frees resources used by the reader.

It interrupts calls to Read.

func (*Reader) Read

func (r *Reader) Read() (Record, error)

Read the next record from the BPF ringbuf.

Calling Close interrupts the function.

type Record

type Record struct {
	RawSample []byte
}

Jump to

Keyboard shortcuts

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