{"id":13472413,"url":"https://github.com/aya-rs/aya","last_synced_at":"2025-05-14T09:02:06.885Z","repository":{"id":37014117,"uuid":"331227477","full_name":"aya-rs/aya","owner":"aya-rs","description":"Aya is an eBPF library for the Rust programming language, built with a focus on developer experience and operability.","archived":false,"fork":false,"pushed_at":"2025-05-06T14:30:56.000Z","size":8121,"stargazers_count":3591,"open_issues_count":168,"forks_count":322,"subscribers_count":44,"default_branch":"main","last_synced_at":"2025-05-07T08:02:02.655Z","etag":null,"topics":["bpf","ebpf","observability","rust","security"],"latest_commit_sha":null,"homepage":"https://aya-rs.dev/book/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aya-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-20T07:31:17.000Z","updated_at":"2025-05-06T18:48:13.000Z","dependencies_parsed_at":"2024-01-29T07:29:18.611Z","dependency_job_id":"9208099b-2c3f-4bdf-a7fa-a22ad97e65ab","html_url":"https://github.com/aya-rs/aya","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aya-rs%2Faya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aya-rs%2Faya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aya-rs%2Faya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aya-rs%2Faya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aya-rs","download_url":"https://codeload.github.com/aya-rs/aya/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110363,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bpf","ebpf","observability","rust","security"],"created_at":"2024-07-31T16:00:54.453Z","updated_at":"2025-05-14T09:02:06.815Z","avatar_url":"https://github.com/aya-rs.png","language":"Rust","funding_links":[],"categories":["eBPF Workflow: Tools and Utilities","Rust","Libraries","security","eBPF 工作流：工具和实用程序","虚拟化"],"sub_categories":["Aya","eBPF"],"readme":"# [![Aya](assets/logo.svg)](https://aya-rs.dev)\n\n[![Crates.io][crates-badge]][crates-url]\n![License][license-badge]\n[![Build status][build-badge]][build-url]\n[![Book][book-badge]][book-url]\n[![Gurubase][gurubase-badge]][gurubase-url]\n\n[crates-badge]: https://img.shields.io/crates/v/aya.svg?style=for-the-badge\u0026logo=rust\n[crates-url]: https://crates.io/crates/aya\n[license-badge]: https://img.shields.io/badge/license-MIT%2FApache--2.0-blue?style=for-the-badge\n[build-badge]: https://img.shields.io/github/actions/workflow/status/aya-rs/aya/ci.yml?style=for-the-badge\n[build-url]: https://github.com/aya-rs/aya/actions/workflows/ci.yml\n[book-badge]: https://img.shields.io/badge/read%20the-book-9cf.svg?style=for-the-badge\u0026logo=mdbook\n[book-url]: https://aya-rs.dev/book\n[gurubase-badge]: https://img.shields.io/badge/Gurubase-Ask%20Aya%20Guru-006BFF?style=for-the-badge\n[gurubase-url]: https://gurubase.io/g/aya\n\n## API Documentation\n\n[![Unreleased Documentation][git-docs-badge]][git-api-docs] [![Documentaiton][api-docs-badge]][api-docs]\n\n[git-docs-badge]: https://img.shields.io/badge/docs-unreleased-red.svg?style=for-the-badge\u0026logo=docsdotrs\n[git-api-docs]: https://docs.aya-rs.dev\n[api-docs-badge]: https://img.shields.io/badge/docs-released-blue.svg?style=for-the-badge\u0026logo=docsdotrs\n[api-docs]: https://docs.rs/aya\n\n## Community\n\n[![Discord][discord-badge]][chat-url] [![Awesome][awesome-badge]][awesome-aya]\n\nJoin [the conversation on Discord][chat-url] to discuss anything related to Aya\nor discover and contribute to a list of [Awesome Aya][awesome-aya] projects.\n\n[discord-badge]: https://img.shields.io/badge/Discord-chat-5865F2?style=for-the-badge\u0026logo=discord\n[chat-url]: https://discord.gg/xHW2cb2N6G\n[awesome-aya]: https://github.com/aya-rs/awesome-aya\n[awesome-badge]: https://img.shields.io/badge/Awesome-Aya-FC60A8?style=for-the-badge\u0026logo=awesomelists\n\n## Overview\n\neBPF is a technology that allows running user-supplied programs inside the Linux\nkernel. For more info see [What is eBPF](https://ebpf.io/what-is-ebpf).\n\nAya is an eBPF library built with a focus on operability and developer\nexperience. It does not rely on [libbpf] nor [bcc] - it's built from the ground\nup purely in Rust, using only the [libc] crate to execute syscalls. With BTF\nsupport and when linked with musl, it offers a true [compile once, run\neverywhere solution][co-re], where a single self-contained binary can be\ndeployed on many linux distributions and kernel versions.\n\nSome of the major features provided include:\n\n* Support for the **BPF Type Format** (BTF), which is transparently enabled when\n  supported by the target kernel. This allows eBPF programs compiled against\n  one kernel version to run on different kernel versions without the need to\n  recompile.\n* Support for function call relocation and global data maps, which\n  allows eBPF programs to make **function calls** and use **global variables\n  and initializers**.\n* **Async support** with both [tokio] and [async-std].\n* Easy to deploy and fast to build: aya doesn't require a kernel build or\n  compiled headers, and not even a C toolchain; a release build completes in a matter\n  of seconds.\n\n[libbpf]: https://github.com/libbpf/libbpf\n[bcc]: https://github.com/iovisor/bcc\n[libc]: https://docs.rs/libc\n[co-re]: https://facebookmicrosites.github.io/bpf/blog/2020/02/19/bpf-portability-and-co-re.html\n[tokio]: https://docs.rs/tokio\n[async-std]: https://docs.rs/async-std\n\n### Example\n\nAya supports a large chunk of the eBPF API. The following example shows how to\nuse a `BPF_PROG_TYPE_CGROUP_SKB` program with aya:\n\n```rust\nuse std::fs::File;\nuse aya::Ebpf;\nuse aya::programs::{CgroupSkb, CgroupSkbAttachType, CgroupAttachMode};\n\n// load the BPF code\nlet mut ebpf = Ebpf::load_file(\"ebpf.o\")?;\n\n// get the `ingress_filter` program compiled into `ebpf.o`.\nlet ingress: \u0026mut CgroupSkb = ebpf.program_mut(\"ingress_filter\")?.try_into()?;\n\n// load the program into the kernel\ningress.load()?;\n\n// attach the program to the root cgroup. `ingress_filter` will be called for all\n// incoming packets.\nlet cgroup = File::open(\"/sys/fs/cgroup/unified\")?;\ningress.attach(cgroup, CgroupSkbAttachType::Ingress, CgroupAttachMode::AllowOverride)?;\n```\n\n## Contributing\n\nPlease see the [contributing guide](https://github.com/aya-rs/aya/blob/main/CONTRIBUTING.md).\n\n## License\n\nAya is distributed under the terms of either the [MIT license] or the\n[Apache License] (version 2.0), at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\n[MIT license]: https://github.com/aya-rs/aya/blob/main/LICENSE-MIT\n[Apache license]: https://github.com/aya-rs/aya/blob/main/LICENSE-APACHE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faya-rs%2Faya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faya-rs%2Faya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faya-rs%2Faya/lists"}