Documentation ¶
Index ¶
- Constants
- func GetUnsafePointer(data interface{}) (unsafe.Pointer, error)
- type BPFLink
- type BPFMap
- func (b *BPFMap) DeleteKey(key interface{}) error
- func (b *BPFMap) GetMaxEntries() uint32
- func (b *BPFMap) GetValue(key interface{}) ([]byte, error)
- func (b *BPFMap) Iterator() *BPFMapIterator
- func (b *BPFMap) KeySize() int
- func (b *BPFMap) Pin(pinPath string) error
- func (b *BPFMap) Resize(maxEntries uint32) error
- func (b *BPFMap) SetPinPath(pinPath string) error
- func (b *BPFMap) Unpin(pinPath string) error
- func (b *BPFMap) Update(key, value interface{}) error
- func (b *BPFMap) ValueSize() int
- type BPFMapIterator
- type BPFProg
- func (p *BPFProg) AttachKprobe(kp string) (*BPFLink, error)
- func (p *BPFProg) AttachKprobeLegacy(kp string) (*BPFLink, error)
- func (p *BPFProg) AttachKretprobe(kp string) (*BPFLink, error)
- func (p *BPFProg) AttachKretprobeLegacy(kp string) (*BPFLink, error)
- func (p *BPFProg) AttachLSM() (*BPFLink, error)
- func (p *BPFProg) AttachPerfEvent(fd int) (*BPFLink, error)
- func (p *BPFProg) AttachRawTracepoint(tpEvent string) (*BPFLink, error)
- func (p *BPFProg) AttachTracepoint(tp string) (*BPFLink, error)
- func (p *BPFProg) AttachURetprobe(pid int, path string, offset uint32) (*BPFLink, error)
- func (p *BPFProg) AttachUprobe(pid int, path string, offset uint32) (*BPFLink, error)
- func (p *BPFProg) GetFd() C.int
- func (p *BPFProg) GetType() uint32
- func (p *BPFProg) SetAutoload(autoload bool) error
- func (p *BPFProg) SetTracepoint() error
- type BPFProgType
- type LinkType
- type Module
- func (m *Module) BPFLoadObject() error
- func (m *Module) Close()
- func (m *Module) GetMap(mapName string) (*BPFMap, error)
- func (m *Module) GetProgram(progName string) (*BPFProg, error)
- func (m *Module) InitPerfBuf(mapName string, eventsChan chan []byte, lostChan chan uint64, pageCnt int) (*PerfBuffer, error)
- func (m *Module) InitRingBuf(mapName string, eventsChan chan []byte) (*RingBuffer, error)
- func (m *Module) TcHookInit() *TcHook
- type PerfBuffer
- type RingBuffer
- type TcAttachPoint
- type TcFlags
- type TcHook
- func (hook *TcHook) Attach(tcOpts *TcOpts) error
- func (hook *TcHook) Create() error
- func (hook *TcHook) Destroy() error
- func (hook *TcHook) Detach(tcOpts *TcOpts) error
- func (hook *TcHook) GetInterfaceIndex() int
- func (hook *TcHook) Query(tcOpts *TcOpts) error
- func (hook *TcHook) SetAttachPoint(attachPoint TcAttachPoint)
- func (hook *TcHook) SetInterfaceByIndex(ifaceIdx int)
- func (hook *TcHook) SetInterfaceByName(ifaceName string) error
- func (hook *TcHook) SetParent(a int, b int)
- type TcOpts
Constants ¶
const ( BPFProgTypeUnspec uint32 = iota BPFProgTypeSocketFilter BPFProgTypeKprobe BPFProgTypeSchedCls BPFProgTypeSchedAct BPFProgTypeTracepoint BPFProgTypeXdp BPFProgTypePerfEvent BPFProgTypeCgroupSkb BPFProgTypeCgroupSock BPFProgTypeLwtIn BPFProgTypeLwtOut BPFProgTypeLwtXmit BPFProgTypeSockOps BPFProgTypeSkSkb BPFProgTypeCgroupDevice BPFProgTypeSkMsg BPFProgTypeRawTracepoint BPFProgTypeCgroupSockAddr BPFProgTypeLwtSeg6Local BPFProgTypeLircMode2 BPFProgTypeSkReuseport BPFProgTypeFlowDissector BPFProgTypeCgroupSysctl BPFProgTypeRawTracepointWritable BPFProgTypeCgroupSockopt BPFProgTypeTracing BPFProgTypeStructOps BPFProgTypeExt BPFProgTypeLsm BPFProgTypeSkLookup )
Variables ¶
This section is empty.
Functions ¶
func GetUnsafePointer ¶
Types ¶
type BPFMap ¶
type BPFMap struct {
// contains filtered or unexported fields
}
func (*BPFMap) GetMaxEntries ¶
GetMaxEntries returns the map's capacity. Note: for ring buffer and perf buffer, maxEntries is the capacity in bytes.
func (*BPFMap) Iterator ¶
func (b *BPFMap) Iterator() *BPFMapIterator
func (*BPFMap) Resize ¶
Resize changes the map's capacity to maxEntries. It should be called after the module was initialized but prior to it being loaded with BPFLoadObject. Note: for ring buffer and perf buffer, maxEntries is the capacity in bytes.
func (*BPFMap) SetPinPath ¶
type BPFMapIterator ¶
type BPFMapIterator struct {
// contains filtered or unexported fields
}
func (*BPFMapIterator) Err ¶
func (it *BPFMapIterator) Err() error
Err returns the last error that ocurred while table.Iter or iter.Next
func (*BPFMapIterator) Key ¶
func (it *BPFMapIterator) Key() []byte
Key returns the current key value of the iterator, if the most recent call to Next returned true. The slice is valid only until the next call to Next.
func (*BPFMapIterator) Next ¶
func (it *BPFMapIterator) Next() bool
type BPFProg ¶
type BPFProg struct {
// contains filtered or unexported fields
}
func (*BPFProg) AttachKprobe ¶
this API should be used for kernels > 4.17
func (*BPFProg) AttachKprobeLegacy ¶
func (*BPFProg) AttachKretprobe ¶
this API should be used for kernels > 4.17
func (*BPFProg) AttachKretprobeLegacy ¶
func (*BPFProg) AttachRawTracepoint ¶
func (*BPFProg) AttachURetprobe ¶
AttachURetprobe attaches the BPFProgram to exit of the symbol in the library or binary at 'path' which can be relative or absolute. A pid can be provided to attach to, or -1 can be specified to attach to all processes
func (*BPFProg) AttachUprobe ¶
AttachUprobe attaches the BPFProgram to entry of the symbol in the library or binary at 'path' which can be relative or absolute. A pid can be provided to attach to, or -1 can be specified to attach to all processes
func (*BPFProg) SetAutoload ¶
func (*BPFProg) SetTracepoint ¶
type BPFProgType ¶
type BPFProgType uint32
BPFProgType is an enum as defined in https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/bpf.h
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func NewModuleFromBuffer ¶
func NewModuleFromFile ¶
func (*Module) BPFLoadObject ¶
func (*Module) InitPerfBuf ¶
func (*Module) InitRingBuf ¶
func (m *Module) InitRingBuf(mapName string, eventsChan chan []byte) (*RingBuffer, error)
func (*Module) TcHookInit ¶
type PerfBuffer ¶
type PerfBuffer struct {
// contains filtered or unexported fields
}
func (*PerfBuffer) Close ¶
func (pb *PerfBuffer) Close()
func (*PerfBuffer) Start ¶
func (pb *PerfBuffer) Start()
func (*PerfBuffer) Stop ¶
func (pb *PerfBuffer) Stop()
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
func (*RingBuffer) Close ¶
func (rb *RingBuffer) Close()
func (*RingBuffer) Start ¶
func (rb *RingBuffer) Start()
func (*RingBuffer) Stop ¶
func (rb *RingBuffer) Stop()
type TcAttachPoint ¶
type TcAttachPoint uint32
const ( BPFTcIngress TcAttachPoint = C.BPF_TC_INGRESS BPFTcEgress TcAttachPoint = C.BPF_TC_EGRESS BPFTcIngressEgress TcAttachPoint = C.BPF_TC_INGRESS | C.BPF_TC_EGRESS BPFTcCustom TcAttachPoint = C.BPF_TC_CUSTOM )
type TcHook ¶
type TcHook struct {
// contains filtered or unexported fields
}
func (*TcHook) GetInterfaceIndex ¶
func (*TcHook) SetAttachPoint ¶
func (hook *TcHook) SetAttachPoint(attachPoint TcAttachPoint)
func (*TcHook) SetInterfaceByIndex ¶
func (*TcHook) SetInterfaceByName ¶
Directories ¶
Path | Synopsis |
---|---|
selftest
|
|
attachgenericfd
Module
|
|
global-variable
Module
|
|
iter
Module
|
|
iterators
Module
|
|
log-callbacks
Module
|
|
map-pin-info
Module
|
|
map-update
Module
|
|
module-attach-detach
Module
|
|
perfbuffers
Module
|
|
tracing
Module
|
|
tracing-by-offset
Module
|
|
uprobe
Module
|