MCPcopy Index your code
hub / github.com/aya-rs/aya

github.com/aya-rs/aya @aya-v0.14.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release aya-v0.14.0 ↗ · + Follow
9,593 symbols 16,631 edges 391 files 493 documented · 5% updated 1d agoaya-ebpf-v0.2.1 · 2026-06-30★ 4,663130 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Aya

Crates.io License [Build status]build-url [Book]book-url [Gurubase]gurubase-url

API Documentation

Unreleased Documentation Documentation

Community

Discord Awesome

Join the conversation on Discord to discuss anything related to Aya or discover and contribute to a list of Awesome Aya projects.

Overview

eBPF is a technology that allows running user-supplied programs inside the Linux kernel. For more info see What is eBPF.

Aya is an eBPF library built with a focus on operability and developer experience. It does not rely on libbpf nor bcc - it's built from the ground up purely in Rust, using only the libc crate to execute syscalls. With BTF support and when linked with musl, it offers a true compile once, run everywhere solution, where a single self-contained binary can be deployed on many linux distributions and kernel versions.

Some of the major features provided include:

  • Support for the BPF Type Format (BTF), which is transparently enabled when supported by the target kernel. This allows eBPF programs compiled against one kernel version to run on different kernel versions without the need to recompile.
  • Support for function call relocation and global data maps, which allows eBPF programs to make function calls and use global variables and initializers.
  • Async support with both tokio and async-std.
  • Easy to deploy and fast to build: aya doesn't require a kernel build or compiled headers, and not even a C toolchain; a release build completes in a matter of seconds.

Example

Aya supports a large chunk of the eBPF API. The following example shows how to use a BPF_PROG_TYPE_CGROUP_SKB program with aya:

use std::fs::File;
use aya::Ebpf;
use aya::programs::{CgroupSkb, CgroupSkbAttachType, CgroupAttachMode};

// load the BPF code
let mut ebpf = Ebpf::load_file("ebpf.o")?;

// get the `ingress_filter` program compiled into `ebpf.o`.
let ingress: &mut CgroupSkb = ebpf.program_mut("ingress_filter")?.try_into()?;

// load the program into the kernel
ingress.load()?;

// attach the program to the root cgroup. `ingress_filter` will be called for all
// incoming packets.
let cgroup = File::open("/sys/fs/cgroup/unified")?;
ingress.attach(cgroup, CgroupSkbAttachType::Ingress, CgroupAttachMode::AllowOverride)?;

Contributing

Please see the contributing guide.

License

Aya is distributed under the terms of either the MIT license or the Apache License (version 2.0), at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

Pod (Interface)
Marker trait for types that can safely be converted to and from byte slices. # Safety This trait is unsafe because it [23 …
aya/src/bpf.rs
Formatter (Interface)
(no doc) [11 implementers]
aya-log/src/lib.rs
EbpfContext (Interface)
(no doc) [22 implementers]
ebpf/aya-ebpf/src/lib.rs
IpFormatter (Interface)
(no doc) [7 implementers]
aya-log-common/src/lib.rs
UnloadProgramOps (Interface)
(no doc)
test/integration-test/src/tests/load.rs
IterableMap (Interface)
An iterable map [10 implementers]
aya/src/maps/mod.rs
Format (Interface)
(no doc) [10 implementers]
aya-log/src/lib.rs
PtRegsLayout (Interface)
(no doc) [8 implementers]
ebpf/aya-ebpf/src/args.rs

Core symbols most depended-on inside this repo

map
called by 157
aya/src/bpf.rs
parse
called by 144
aya-log-parser/src/lib.rs
get
called by 138
aya-obj/src/btf/info.rs
load
called by 126
aya/src/bpf.rs
program_mut
called by 101
aya/src/bpf.rs
len
called by 97
aya-obj/src/btf/btf.rs
iter
called by 95
aya/src/maps/lpm_trie.rs
as_fd
called by 84
aya/src/programs/mod.rs

Shape

Method 3,250
Class 2,921
Function 2,898
Enum 489
Interface 35

Languages

Rust99%
C1%
C++1%

Modules by API surface

aya-obj/src/generated/linux_bindings_x86_64.rs351 symbols
aya-obj/src/generated/linux_bindings_s390x.rs351 symbols
aya-obj/src/generated/linux_bindings_riscv64.rs351 symbols
aya-obj/src/generated/linux_bindings_powerpc64.rs351 symbols
aya-obj/src/generated/linux_bindings_mips64.rs351 symbols
aya-obj/src/generated/linux_bindings_mips.rs351 symbols
aya-obj/src/generated/linux_bindings_loongarch64.rs351 symbols
aya-obj/src/generated/linux_bindings_armv7.rs351 symbols
aya-obj/src/generated/linux_bindings_aarch64.rs351 symbols
ebpf/aya-ebpf-bindings/src/s390x/bindings.rs312 symbols
ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs211 symbols
ebpf/aya-ebpf-bindings/src/loongarch64/bindings.rs211 symbols

For agents

$ claude mcp add aya \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page