aya
aya copied to clipboard
Add an ARCHITECTURE.md
I think an ARCHITECTURE.md would also go a long way for getting new contributors up to speed. Even something simple that describes what each crate is for, etc. This looks like an awesome (and very promising) project, and I would love to contribute, but the number of crates and subcrates in this workspace can be a bit overwhelming at first glance. Thanks a lot for your work on the library :)
Oh absolutely! Docs - both on how to contribute and how to use the library - are my personal #1 priority right now.
In the meantime:
- the
ayacrate includes the user space library, that is what is used to load and attach eBPF programs - the
xtaskcrate is an internal crate used to automate some tasks, see https://github.com/matklad/cargo-xtask -
aya-genis a crate (and a binary) used to generate rust bindings from BTF debug info. It's used to generate some internal bindings used by theayacrate, and for some bindings exported byaya-bpf. -
aya-bpfis a crate you can use from eBPF programs (so kernel side). It provides a high level API for maps and programs similar to the APIayaexports in userspace. It also exportsproc_macros you can use to simplify defining programs, eg:
#[classifier(name = "ingress_filter")]
fn tc_cls_ingress_proxy(skb: SkSkbContext) -> i32 {
match try_tc_cls_ingress_filter(skb) {
Ok(ret) => ret,
Err(_) => TC_ACT_OK as i32,
}
}
-
aya-bpf-bindingsincludes generated bindings for bpf-helpers and some common eBPF kernel structs, it's re-exported byaya-bpf. -
aya-bpf-macrosincludes theproc_macros used to define eBPF programs. Also re-exported byaya-bpf.
Thanks for the high-level explanation, that helps quite a lot. :)