chore: Use `aya`, `aya-ebpf` and `aya-log` from crates.io

pull/103/head^2
Michal Rostecki 5 months ago
parent 97e817d110
commit f642921fee

@ -8,7 +8,7 @@ default = []
user = ["aya"] user = ["aya"]
[dependencies] [dependencies]
aya = { git = "https://github.com/aya-rs/aya", optional = true } aya = { version = "0.12", optional = true }
[lib] [lib]
path = "src/lib.rs" path = "src/lib.rs"

@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
aya-ebpf = { git = "https://github.com/aya-rs/aya" } aya-ebpf = "0.1.0"
aya-log-ebpf = { git = "https://github.com/aya-rs/aya" } aya-log-ebpf = "0.1.0"
{{ project-name }}-common = { path = "../{{ project-name }}-common" } {{ project-name }}-common = { path = "../{{ project-name }}-common" }
[[bin]] [[bin]]

@ -5,8 +5,8 @@ edition = "2021"
publish = false publish = false
[dependencies] [dependencies]
aya = { git = "https://github.com/aya-rs/aya", features = ["async_tokio"] } aya = "0.12"
aya-log = { git = "https://github.com/aya-rs/aya" } aya-log = "0.2"
{% if program_types_with_opts contains program_type -%} {% if program_types_with_opts contains program_type -%}
clap = { version = "4.1", features = ["derive"] } clap = { version = "4.1", features = ["derive"] }
{% endif -%} {% endif -%}

@ -39,8 +39,8 @@ use aya::programs::SocketFilter;
{%- when "raw_tracepoint" -%} {%- when "raw_tracepoint" -%}
use aya::programs::RawTracePoint; use aya::programs::RawTracePoint;
{%- endcase %} {%- endcase %}
use aya::{include_bytes_aligned, Ebpf}; use aya::{include_bytes_aligned, Bpf};
use aya_log::EbpfLogger; use aya_log::BpfLogger;
{% if program_types_with_opts contains program_type -%} {% if program_types_with_opts contains program_type -%}
use clap::Parser; use clap::Parser;
{% endif -%} {% endif -%}
@ -86,14 +86,14 @@ async fn main() -> Result<(), anyhow::Error> {
// like to specify the eBPF program at runtime rather than at compile-time, you can // like to specify the eBPF program at runtime rather than at compile-time, you can
// reach for `Bpf::load_file` instead. // reach for `Bpf::load_file` instead.
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
let mut bpf = Ebpf::load(include_bytes_aligned!( let mut bpf = Bpf::load(include_bytes_aligned!(
"../../target/bpfel-unknown-none/debug/{{project-name}}" "../../target/bpfel-unknown-none/debug/{{project-name}}"
))?; ))?;
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
let mut bpf = Ebpf::load(include_bytes_aligned!( let mut bpf = Bpf::load(include_bytes_aligned!(
"../../target/bpfel-unknown-none/release/{{project-name}}" "../../target/bpfel-unknown-none/release/{{project-name}}"
))?; ))?;
if let Err(e) = EbpfLogger::init(&mut bpf) { if let Err(e) = BpfLogger::init(&mut bpf) {
// This can happen if you remove all log statements from your eBPF program. // This can happen if you remove all log statements from your eBPF program.
warn!("failed to initialize eBPF logger: {}", e); warn!("failed to initialize eBPF logger: {}", e);
} }

Loading…
Cancel
Save