| 1 | # eBPF |
| 2 | |
| 3 | [](https://pkg.go.dev/github.com/cilium/ebpf) |
| 4 | |
| 5 |  |
| 6 | |
| 7 | ebpf-go is a pure Go library that provides utilities for loading, compiling, and |
| 8 | debugging eBPF programs. It has minimal external dependencies and is intended to |
| 9 | be used in long running processes. |
| 10 | |
| 11 | See [ebpf.io](https://ebpf.io) for complementary projects from the wider eBPF |
| 12 | ecosystem. |
| 13 | |
| 14 | ## Getting Started |
| 15 | |
| 16 | Please take a look at our [Getting Started] guide. |
| 17 | |
| 18 | [Contributions](https://ebpf-go.dev/contributing) are highly encouraged, as they highlight certain use cases of |
| 19 | eBPF and the library, and help shape the future of the project. |
| 20 | |
| 21 | ## Getting Help |
| 22 | |
| 23 | The community actively monitors our [GitHub Discussions](https://github.com/cilium/ebpf/discussions) page. |
| 24 | Please search for existing threads before starting a new one. Refrain from |
| 25 | opening issues on the bug tracker if you're just starting out or if you're not |
| 26 | sure if something is a bug in the library code. |
| 27 | |
| 28 | Alternatively, [join](https://ebpf.io/slack) the |
| 29 | [#ebpf-go](https://cilium.slack.com/messages/ebpf-go) channel on Slack if you |
| 30 | have other questions regarding the project. Note that this channel is ephemeral |
| 31 | and has its history erased past a certain point, which is less helpful for |
| 32 | others running into the same problem later. |
| 33 | |
| 34 | ## Packages |
| 35 | |
| 36 | This library includes the following packages: |
| 37 | |
| 38 | * [asm](https://pkg.go.dev/github.com/cilium/ebpf/asm) contains a basic |
| 39 | assembler, allowing you to write eBPF assembly instructions directly |
| 40 | within your Go code. (You don't need to use this if you prefer to write your eBPF program in C.) |
| 41 | * [cmd/bpf2go](https://pkg.go.dev/github.com/cilium/ebpf/cmd/bpf2go) allows |
| 42 | compiling and embedding eBPF programs written in C within Go code. As well as |
| 43 | compiling the C code, it auto-generates Go code for loading and manipulating |
| 44 | the eBPF program and map objects. |
| 45 | * [link](https://pkg.go.dev/github.com/cilium/ebpf/link) allows attaching eBPF |
| 46 | to various hooks |
| 47 | * [perf](https://pkg.go.dev/github.com/cilium/ebpf/perf) allows reading from a |
| 48 | `PERF_EVENT_ARRAY` |
| 49 | * [ringbuf](https://pkg.go.dev/github.com/cilium/ebpf/ringbuf) allows reading from a |
| 50 | `BPF_MAP_TYPE_RINGBUF` map |
| 51 | * [features](https://pkg.go.dev/github.com/cilium/ebpf/features) implements the equivalent |
| 52 | of `bpftool feature probe` for discovering BPF-related kernel features using native Go. |
| 53 | * [rlimit](https://pkg.go.dev/github.com/cilium/ebpf/rlimit) provides a convenient API to lift |
| 54 | the `RLIMIT_MEMLOCK` constraint on kernels before 5.11. |
| 55 | * [btf](https://pkg.go.dev/github.com/cilium/ebpf/btf) allows reading the BPF Type Format. |
| 56 | * [pin](https://pkg.go.dev/github.com/cilium/ebpf/pin) provides APIs for working with pinned objects on bpffs. |
| 57 | |
| 58 | ## Requirements |
| 59 | |
| 60 | * A version of Go that is [supported by |
| 61 | upstream](https://golang.org/doc/devel/release.html#policy) |
| 62 | * Linux (amd64, arm64): CI is run against kernel.org LTS releases. >= 4.4 should work but EOL'ed |
| 63 | versions are not supported. |
| 64 | * Windows (amd64): CI is run against Windows Server 2022. Only the latest eBPF for Windows |
| 65 | release is supported. |
| 66 | * Other architectures are best effort. 32bit arches are not supported. |
| 67 | |
| 68 | ## License |
| 69 | |
| 70 | MIT |
| 71 | |
| 72 | ### eBPF Gopher |
| 73 | |
| 74 | The eBPF honeygopher is based on the Go gopher designed by Renee French. |
| 75 | |
| 76 | [Getting Started]: https://ebpf-go.dev/guides/getting-started/ |