Documentation ¶
Index ¶
- Variables
- func CleanupAllMockMaps()
- type MockMap
- func (m *MockMap) CloneTemplate() goebpf.Map
- func (m *MockMap) Close() error
- func (m *MockMap) Create() error
- func (m *MockMap) Delete(ikey interface{}) error
- func (m *MockMap) Destroy() error
- func (m *MockMap) GetFd() int
- func (m *MockMap) GetName() string
- func (m *MockMap) GetNextKey(ikey interface{}) ([]byte, error)
- func (m *MockMap) GetNextKeyInt(ikey interface{}) (int, error)
- func (m *MockMap) GetNextKeyString(ikey interface{}) (string, error)
- func (m *MockMap) GetNextKeyUint64(ikey interface{}) (uint64, error)
- func (m *MockMap) GetType() goebpf.MapType
- func (m *MockMap) Insert(ikey interface{}, ivalue interface{}) error
- func (m *MockMap) Lookup(ikey interface{}) ([]byte, error)
- func (m *MockMap) LookupInt(ikey interface{}) (int, error)
- func (m *MockMap) LookupString(ikey interface{}) (string, error)
- func (m *MockMap) LookupUint64(ikey interface{}) (uint64, error)
- func (m *MockMap) Update(ikey interface{}, ivalue interface{}) error
- func (m *MockMap) Upsert(ikey interface{}, ivalue interface{}) error
- type MockProgram
- func (m *MockProgram) Attach(meta interface{}) error
- func (m *MockProgram) Close() error
- func (m *MockProgram) Detach() error
- func (m *MockProgram) GetFd() int
- func (m *MockProgram) GetLicense() string
- func (m *MockProgram) GetName() string
- func (m *MockProgram) GetSection() string
- func (m *MockProgram) GetSize() int
- func (m *MockProgram) GetType() goebpf.ProgramType
- func (m *MockProgram) Load() error
- func (m *MockProgram) Pin(path string) error
- type MockSystem
- func (m *MockSystem) GetMapByName(name string) goebpf.Map
- func (m *MockSystem) GetMaps() map[string]goebpf.Map
- func (m *MockSystem) GetProgramByName(name string) goebpf.Program
- func (m *MockSystem) GetPrograms() map[string]goebpf.Program
- func (m *MockSystem) Load(r io.ReaderAt) error
- func (m *MockSystem) LoadElf(path string) error
Constants ¶
This section is empty.
Variables ¶
var MockMaps map[string]goebpf.Map
MockMaps is list of cross compiled/linked eBPF maps into GO executable This map will contain all eBPF maps defined in eBPF program
Functions ¶
func CleanupAllMockMaps ¶
func CleanupAllMockMaps()
CleanupAllMockMaps re-creates all mock maps Useful for unittests
Types ¶
type MockMap ¶
type MockMap struct { Name string Type goebpf.MapType KeySize int ValueSize int MaxEntries int // contains filtered or unexported fields }
MockMap defines eBPF mockmap and implements Map interface
func (*MockMap) CloneTemplate ¶
CloneTemplate creates clone of current map
func (*MockMap) GetNextKey ¶
GetNextKey gets the next key of the provided key
func (*MockMap) GetNextKeyInt ¶
func (*MockMap) GetNextKeyString ¶
func (*MockMap) GetNextKeyUint64 ¶
func (*MockMap) LookupString ¶
LookupString perform lookup and returns GO string from NULL terminated C string
func (*MockMap) LookupUint64 ¶
LookupUint64 perform lookup and returns uint64
type MockProgram ¶
type MockProgram struct { Attached bool Fd int License string Name string Section string Size int ProgType goebpf.ProgramType }
MockProgram is mock implementation for eBPF program
func NewMockProgram ¶
func NewMockProgram(name string, tp goebpf.ProgramType) *MockProgram
NewMockProgram creates new mock program of tp type.
func (*MockProgram) Attach ¶
func (m *MockProgram) Attach(meta interface{}) error
Attach does nothing, only to implement Program interface
func (*MockProgram) Close ¶
func (m *MockProgram) Close() error
Close does nothing, only to implement Program interface
func (*MockProgram) Detach ¶
func (m *MockProgram) Detach() error
Detach does nothing, only to implement Program interface
func (*MockProgram) GetLicense ¶
func (m *MockProgram) GetLicense() string
GetLicense return program's license
func (*MockProgram) GetSection ¶
func (m *MockProgram) GetSection() string
GetSection returns the section name used by the program
func (*MockProgram) GetSize ¶
func (m *MockProgram) GetSize() int
GetSize returns program size set by user
func (*MockProgram) GetType ¶
func (m *MockProgram) GetType() goebpf.ProgramType
GetType returns program type
func (*MockProgram) Load ¶
func (m *MockProgram) Load() error
Load does nothing, only to implement Program interface
func (*MockProgram) Pin ¶
func (m *MockProgram) Pin(path string) error
Pin does nothing, just returns nil
type MockSystem ¶
type MockSystem struct { Programs map[string]goebpf.Program Maps map[string]goebpf.Map // ErrorLoadElf specifies return value for LoadElf() method. ErrorLoadElf error }
MockSystem is mock implementation of eBPF system
func NewMockSystem ¶
func NewMockSystem() *MockSystem
NewMockSystem creates mocked eBPF system with: - empty program map - all linked mock maps
func (*MockSystem) GetMapByName ¶
func (m *MockSystem) GetMapByName(name string) goebpf.Map
GetMapByName returns eBPF map by name or nil if not found
func (*MockSystem) GetMaps ¶
func (m *MockSystem) GetMaps() map[string]goebpf.Map
GetMaps returns all linked eBPF maps
func (*MockSystem) GetProgramByName ¶
func (m *MockSystem) GetProgramByName(name string) goebpf.Program
GetProgramByName returns eBPF program by name or nil if not found
func (*MockSystem) GetPrograms ¶
func (m *MockSystem) GetPrograms() map[string]goebpf.Program
GetPrograms returns map of added eBPF programs
func (*MockSystem) Load ¶
func (m *MockSystem) Load(r io.ReaderAt) error
Load does nothing, just a mock for original Load
func (*MockSystem) LoadElf ¶
func (m *MockSystem) LoadElf(path string) error
LoadElf does nothing, just a mock for original LoadElf
Directories ¶
Path | Synopsis |
---|---|
Package wrapper is wrapper for "cross compiled" XDP in order to call it right from GO P.S. this should be as part of *_test.go files, however, GO does not support using import "C" from tests...
|
Package wrapper is wrapper for "cross compiled" XDP in order to call it right from GO P.S. this should be as part of *_test.go files, however, GO does not support using import "C" from tests... |