UNPKG

ebpf-support

Version:

A Node.js package to check if the system supports eBPF and return related metadata

62 lines (44 loc) 1.65 kB
# ebpf-support A Node.js package to check if the system supports eBPF and return related metadata. ## Installation ```bash npm install ebpf-support ``` ## Usage ```javascript const { isEbpfSupported, checkEbpfSupport } = require('ebpf-support'); // Simple check if (isEbpfSupported()) { console.log('eBPF is supported on this system'); } else { console.log('eBPF is not supported on this system'); } // Get detailed metadata const metadata = checkEbpfSupport(); console.log(metadata); ``` ## Metadata The `checkEbpfSupport()` function returns an object with the following properties: | Property | Type | Description | |----------|------|-------------| | `supported` | boolean | Whether eBPF is supported on the system | | `kernelVersion` | string | The kernel version of the system | | `bpfConfigEnabled` | boolean | Whether BPF is enabled in the kernel config | | `bpfSyscallEnabled` | boolean | Whether BPF syscall is enabled | | `bpfJitEnabled` | boolean | Whether BPF JIT compiler is enabled | | `bpfJitAlwaysOn` | boolean | Whether BPF JIT is always on | | `bpfFilesystemMounted` | boolean | Whether BPF filesystem is mounted | | `bpfToolAvailable` | boolean | Whether bpftool is available on the system | | `bpfFeatures` | object | Detailed BPF features from bpftool (if available) | | `configFlags` | object | BPF-related kernel config flags | | `reason` | string | Reason why eBPF is not supported (if applicable) | ## Requirements - Node.js 16.0.0 or later - Linux operating system (eBPF is only supported on Linux) ## Testing Run the tests using Node.js's built-in test runner: ```bash npm test ``` ## License MIT