Versions in this module Expand all Collapse all v0 v0.6.2 Nov 30, 2023 v0.4.7 Nov 30, 2023 Changes in this version + type BPFLinkLegacy struct + type BPFMapBatchOpts struct + ElemFlags uint64 + Flags uint64 + Sz uint64 type BPFMapCreateOpts + BtfFD uint32 + BtfKeyTypeID uint32 + BtfValueTypeID uint32 + BtfVmlinuxValueTypeID uint32 + Size uint64 v0.4.6 Nov 30, 2023 Changes in this version + const LibbpfDebugLevel + const LibbpfInfoLevel + const LibbpfWarnLevel + func BPFMapTypeIsSupported(mapType MapType) (bool, error) + func BPFProgramTypeIsSupported(progType BPFProgType) (bool, error) + func GetBTFFDByID(id uint32) (int, error) + func GetMapFDByID(id uint32) (int, error) + func GetMapNextID(startId uint32) (uint32, error) + func GetMapsIDsByName(name string, startId *uint32) ([]uint32, error) + func LibbpfVersionString() string + func MajorVersion() int + func MinorVersion() int + func NumPossibleCPUs() (int, error) + func SetLoggerCbs(cbs Callbacks) + func SetStrictMode(mode LibbpfStrictMode) + type AttachFlag uint32 + const BPFFAllowMulti + const BPFFAllowOverride + const BPFFNone + const BPFFReplace + type BPFAttachType uint32 + const BPFAttachTypeCgroupDevice + const BPFAttachTypeCgroupGetSockOpt + const BPFAttachTypeCgroupInet4Bind + const BPFAttachTypeCgroupInet4Connect + const BPFAttachTypeCgroupInet4GetPeerName + const BPFAttachTypeCgroupInet4GetSockName + const BPFAttachTypeCgroupInet4PostBind + const BPFAttachTypeCgroupInet6Bind + const BPFAttachTypeCgroupInet6Connect + const BPFAttachTypeCgroupInet6GetPeerName + const BPFAttachTypeCgroupInet6GetSockName + const BPFAttachTypeCgroupInet6PostBind + const BPFAttachTypeCgroupInetEgress + const BPFAttachTypeCgroupInetIngress + const BPFAttachTypeCgroupInetSockCreate + const BPFAttachTypeCgroupInetSockRelease + const BPFAttachTypeCgroupSetSockOpt + const BPFAttachTypeCgroupSockOps + const BPFAttachTypeCgroupSysctl + const BPFAttachTypeCgroupUDP4RecvMsg + const BPFAttachTypeCgroupUDP4SendMsg + const BPFAttachTypeCgroupUDP6RecvMsg + const BPFAttachTypeCgroupUDP6SendMsg + const BPFAttachTypeFlowDissector + const BPFAttachTypeLSMMac + const BPFAttachTypeLircMode2 + const BPFAttachTypeModifyReturn + const BPFAttachTypePerfEvent + const BPFAttachTypeSKLookup + const BPFAttachTypeSKMSGVerdict + const BPFAttachTypeSKReusePortSelect + const BPFAttachTypeSKReusePortSelectorMigrate + const BPFAttachTypeSKSKBStreamParser + const BPFAttachTypeSKSKBStreamVerdict + const BPFAttachTypeSKSKBVerdict + const BPFAttachTypeTraceFentry + const BPFAttachTypeTraceFexit + const BPFAttachTypeTraceIter + const BPFAttachTypeTraceKprobeMulti + const BPFAttachTypeTraceRawTP + const BPFAttachTypeXDP + const BPFAttachTypeXDPCPUMap + const BPFAttachTypeXDPDevMap + func (t BPFAttachType) Name() string + func (t BPFAttachType) String() string + type BPFCgroupIterOrder uint32 + const BPFIterAncestorsUp + const BPFIterDescendantsPost + const BPFIterDescendantsPre + const BPFIterOrderUnspec + const BPFIterSelfOnly + type BPFLink struct + func (l *BPFLink) Destroy() error + func (l *BPFLink) DestroyLegacy(linkType LinkType) error + func (l *BPFLink) FileDescriptor() int + func (l *BPFLink) GetFd() int + func (l *BPFLink) Pin(pinPath string) error + func (l *BPFLink) Reader() (*BPFLinkReader, error) + func (l *BPFLink) Unpin() error + type BPFLinkReader struct + func (i *BPFLinkReader) Close() error + func (i *BPFLinkReader) Read(p []byte) (n int, err error) + type BPFMap struct + func (m *BPFMap) Autocreate() bool + func (m *BPFMap) BTFKeyTypeID() uint32 + func (m *BPFMap) BTFValueTypeID() uint32 + func (m *BPFMap) DeleteKey(key unsafe.Pointer) error + func (m *BPFMap) DeleteKeyBatch(keys unsafe.Pointer, count uint32) error + func (m *BPFMap) FileDescriptor() int + func (m *BPFMap) GetFd() int + func (m *BPFMap) GetMaxEntries() uint32 + func (m *BPFMap) GetModule() *Module + func (m *BPFMap) GetName() string + func (m *BPFMap) GetPinPath() string + func (m *BPFMap) GetValue(key unsafe.Pointer) ([]byte, error) + func (m *BPFMap) GetValueAndDeleteBatch(keys, startKey, nextKey unsafe.Pointer, count uint32) ([][]byte, error) + func (m *BPFMap) GetValueBatch(keys unsafe.Pointer, startKey, nextKey unsafe.Pointer, count uint32) ([][]byte, error) + func (m *BPFMap) GetValueFlags(key unsafe.Pointer, flags MapFlag) ([]byte, error) + func (m *BPFMap) GetValueReadInto(key unsafe.Pointer, value *[]byte) error + func (m *BPFMap) IfIndex() uint32 + func (m *BPFMap) InitialValue() ([]byte, error) + func (m *BPFMap) InnerMapInfo() (*BPFMapInfo, error) + func (m *BPFMap) IsPinned() bool + func (m *BPFMap) Iterator() *BPFMapIterator + func (m *BPFMap) KeySize() int + func (m *BPFMap) MapExtra() uint64 + func (m *BPFMap) MapFlags() MapFlag + func (m *BPFMap) MaxEntries() uint32 + func (m *BPFMap) Module() *Module + func (m *BPFMap) Name() string + func (m *BPFMap) Pin(pinPath string) error + func (m *BPFMap) PinPath() string + func (m *BPFMap) Resize(maxEntries uint32) error + func (m *BPFMap) ReuseFD(fd int) error + func (m *BPFMap) SetAutocreate(autocreate bool) error + func (m *BPFMap) SetInitialValue(value unsafe.Pointer) error + func (m *BPFMap) SetInnerMap(templateMapFD int) error + func (m *BPFMap) SetKeySize(size uint32) error + func (m *BPFMap) SetMaxEntries(maxEntries uint32) error + func (m *BPFMap) SetPinPath(pinPath string) error + func (m *BPFMap) SetType(mapType MapType) error + func (m *BPFMap) SetValueSize(size uint32) error + func (m *BPFMap) Type() MapType + func (m *BPFMap) Unpin(pinPath string) error + func (m *BPFMap) Update(key, value unsafe.Pointer) error + func (m *BPFMap) UpdateBatch(keys, values unsafe.Pointer, count uint32) error + func (m *BPFMap) UpdateValueFlags(key, value unsafe.Pointer, flags MapFlag) error + func (m *BPFMap) ValueSize() int + type BPFMapCreateOpts struct + BTFFD uint32 + BTFKeyTypeID uint32 + BTFValueTypeID uint32 + BTFVmlinuxValueTypeID uint32 + InnerMapFD uint32 + MapExtra uint64 + MapFlags uint32 + MapIfIndex uint32 + NumaNode uint32 + type BPFMapInfo struct + BTFID uint32 + BTFKeyTypeID uint32 + BTFValueTypeID uint32 + BTFVmlinuxValueTypeID uint32 + ID uint32 + IfIndex uint32 + KeySize uint32 + MapExtra uint64 + MapFlags uint32 + MaxEntries uint32 + Name string + NetnsDev uint64 + NetnsIno uint64 + Type MapType + ValueSize uint32 + func GetMapInfoByFD(fd int) (*BPFMapInfo, error) + type BPFMapIterator struct + func (it *BPFMapIterator) Err() error + func (it *BPFMapIterator) Key() []byte + func (it *BPFMapIterator) Next() bool + type BPFMapLow struct + func CreateMap(mapType MapType, mapName string, keySize, valueSize, maxEntries int, ...) (*BPFMapLow, error) + func GetMapByID(id uint32) (*BPFMapLow, error) + func (m *BPFMapLow) DeleteKey(key unsafe.Pointer) error + func (m *BPFMapLow) DeleteKeyBatch(keys unsafe.Pointer, count uint32) error + func (m *BPFMapLow) FileDescriptor() int + func (m *BPFMapLow) GetValue(key unsafe.Pointer) ([]byte, error) + func (m *BPFMapLow) GetValueAndDeleteBatch(keys, startKey, nextKey unsafe.Pointer, count uint32) ([][]byte, error) + func (m *BPFMapLow) GetValueBatch(keys unsafe.Pointer, startKey, nextKey unsafe.Pointer, count uint32) ([][]byte, error) + func (m *BPFMapLow) GetValueFlags(key unsafe.Pointer, flags MapFlag) ([]byte, error) + func (m *BPFMapLow) Iterator() *BPFMapIterator + func (m *BPFMapLow) KeySize() int + func (m *BPFMapLow) MaxEntries() uint32 + func (m *BPFMapLow) Name() string + func (m *BPFMapLow) ReuseFD(fd int) error + func (m *BPFMapLow) Type() MapType + func (m *BPFMapLow) Update(key, value unsafe.Pointer) error + func (m *BPFMapLow) UpdateBatch(keys, values unsafe.Pointer, count uint32) error + func (m *BPFMapLow) UpdateValueFlags(key, value unsafe.Pointer, flags MapFlag) error + func (m *BPFMapLow) ValueSize() int + type BPFObjectIterator struct + func (it *BPFObjectIterator) NextMap() *BPFMap + func (it *BPFObjectIterator) NextProgram() *BPFProg + type BPFProg struct + func (p *BPFProg) AttachCgroup(cgroupV2DirPath string) (*BPFLink, error) + func (p *BPFProg) AttachCgroupLegacy(cgroupV2DirPath string, attachType BPFAttachType) (*BPFLink, error) + func (p *BPFProg) AttachGeneric() (*BPFLink, error) + func (p *BPFProg) AttachGenericFD(targetFd int, attachType BPFAttachType, flags AttachFlag) error + func (p *BPFProg) AttachIter(opts IterOpts) (*BPFLink, error) + func (p *BPFProg) AttachKprobe(kp string) (*BPFLink, error) + func (p *BPFProg) AttachKretprobe(kp string) (*BPFLink, error) + func (p *BPFProg) AttachLSM() (*BPFLink, error) + func (p *BPFProg) AttachNetns(networkNamespacePath string) (*BPFLink, error) + func (p *BPFProg) AttachPerfEvent(fd int) (*BPFLink, error) + func (p *BPFProg) AttachRawTracepoint(tpEvent string) (*BPFLink, error) + func (p *BPFProg) AttachTracepoint(category, name 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) AttachXDP(deviceName string) (*BPFLink, error) + func (p *BPFProg) DetachCgroupLegacy(cgroupV2DirPath string, attachType BPFAttachType) error + func (p *BPFProg) DetachGenericFD(targetFd int, attachType BPFAttachType) error + func (p *BPFProg) FileDescriptor() int + func (p *BPFProg) GetFd() int + func (p *BPFProg) GetModule() *Module + func (p *BPFProg) GetName() string + func (p *BPFProg) GetPinPath() string + func (p *BPFProg) GetSectionName() string + func (p *BPFProg) GetType() BPFProgType + func (p *BPFProg) Name() string + func (p *BPFProg) Pin(path string) error + func (p *BPFProg) PinPath() string + func (p *BPFProg) SectionName() string + func (p *BPFProg) SetAttachTarget(attachProgFD int, attachFuncName string) error + func (p *BPFProg) SetAttachType(attachType BPFAttachType) + func (p *BPFProg) SetAutoload(autoload bool) error + func (p *BPFProg) SetProgramType(progType BPFProgType) + func (p *BPFProg) Unpin(path string) error + type BPFProgType uint32 + const BPFProgTypeCgroupDevice + const BPFProgTypeCgroupSkb + const BPFProgTypeCgroupSock + const BPFProgTypeCgroupSockAddr + const BPFProgTypeCgroupSockopt + const BPFProgTypeCgroupSysctl + const BPFProgTypeExt + const BPFProgTypeFlowDissector + const BPFProgTypeKprobe + const BPFProgTypeLircMode2 + const BPFProgTypeLsm + const BPFProgTypeLwtIn + const BPFProgTypeLwtOut + const BPFProgTypeLwtSeg6Local + const BPFProgTypeLwtXmit + const BPFProgTypePerfEvent + const BPFProgTypeRawTracepoint + const BPFProgTypeRawTracepointWritable + const BPFProgTypeSchedAct + const BPFProgTypeSchedCls + const BPFProgTypeSkLookup + const BPFProgTypeSkMsg + const BPFProgTypeSkReuseport + const BPFProgTypeSkSkb + const BPFProgTypeSockOps + const BPFProgTypeSocketFilter + const BPFProgTypeStructOps + const BPFProgTypeSyscall + const BPFProgTypeTracepoint + const BPFProgTypeTracing + const BPFProgTypeUnspec + const BPFProgTypeXdp + func (t BPFProgType) Name() string + func (t BPFProgType) String() string + func (t BPFProgType) Value() uint64 + type Callbacks struct + Log func(level int, msg string) + LogFilters []func(libLevel int, msg string) bool + type IterOpts struct + CgroupFd int + CgroupId uint64 + CgroupIterOrder BPFCgroupIterOrder + MapFd int + Pid int + PidFd int + Tid int + type LibbpfStrictMode uint32 + const LibbpfStrictModeAll + const LibbpfStrictModeAutoRlimitMemlock + const LibbpfStrictModeCleanPtrs + const LibbpfStrictModeDirectErrs + const LibbpfStrictModeMapDefinitions + const LibbpfStrictModeNoObjectList + const LibbpfStrictModeNone + const LibbpfStrictModeSecName + func (b LibbpfStrictMode) String() (str string) + type LinkType int + const Cgroup + const CgroupLegacy + const Iter + const Kprobe + const Kretprobe + const LSM + const Netns + const PerfEvent + const RawTracepoint + const Tracepoint + const Tracing + const Uprobe + const Uretprobe + const XDP + type MapFlag uint32 + const MapFlagFLock + const MapFlagUpdateAny + const MapFlagUpdateExist + const MapFlagUpdateNoExist + type MapType uint32 + const MapTypeArray + const MapTypeArrayOfMaps + const MapTypeBloomFilter + const MapTypeCPUMap + const MapTypeCgroupArray + const MapTypeCgroupStorage + const MapTypeDevMap + const MapTypeDevmapHash + const MapTypeHash + const MapTypeHashOfMaps + const MapTypeInodeStorage + const MapTypeLPMTrie + const MapTypeLRUHash + const MapTypeLRUPerCPUHash + const MapTypePerCPUArray + const MapTypePerCPUCgroupStorage + const MapTypePerCPUHash + const MapTypePerfEventArray + const MapTypeProgArray + const MapTypeQueue + const MapTypeReusePortSockArray + const MapTypeRingbuf + const MapTypeSKStorage + const MapTypeSockHash + const MapTypeSockMap + const MapTypeStack + const MapTypeStackTrace + const MapTypeStructOps + const MapTypeTaskStorage + const MapTypeUnspec + const MapTypeXSKMap + func (t MapType) Name() string + func (t MapType) String() string + type Module struct + func NewModuleFromBuffer(bpfObjBuff []byte, bpfObjName string) (*Module, error) + func NewModuleFromBufferArgs(args NewModuleArgs) (*Module, error) + func NewModuleFromFile(bpfObjPath string) (*Module, error) + func NewModuleFromFileArgs(args NewModuleArgs) (*Module, error) + 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) InitGlobalVariable(name string, value interface{}) 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) Iterator() *BPFObjectIterator + func (m *Module) TcHookInit() *TcHook + type NewModuleArgs struct + BPFObjBuff []byte + BPFObjName string + BPFObjPath string + BTFObjPath string + KConfigFilePath string + SkipMemlockBump bool + type PerfBuffer struct + func (pb *PerfBuffer) Close() + func (pb *PerfBuffer) Poll(timeout int) + func (pb *PerfBuffer) Start() + func (pb *PerfBuffer) Stop() + type RingBuffer struct + func (rb *RingBuffer) Close() + func (rb *RingBuffer) Poll(timeout int) + func (rb *RingBuffer) Start() + func (rb *RingBuffer) Stop() + type Symbol struct + type TcAttachPoint uint32 + const BPFTcCustom + const BPFTcEgress + const BPFTcIngress + const BPFTcIngressEgress + type TcFlags uint32 + const BpfTcFReplace + type TcHook struct + 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 struct + Flags TcFlags + Handle uint + Priority uint + ProgFd int + ProgId uint v0.4.5-libbpf-1.0.1 Nov 30, 2023