feat(relay): make interface for eBPF program configurable (#8592)

This commit is contained in:
Thomas Eizinger
2025-04-01 19:20:27 +11:00
committed by GitHub
parent a942dee723
commit cff14b3da0
2 changed files with 6 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ pub struct Program {
}
impl Program {
pub fn try_load(interface: &'static str) -> Result<Self> {
pub fn try_load(interface: &str) -> Result<Self> {
let mut ebpf = aya::Ebpf::load(aya::include_bytes_aligned!(concat!(
env!("OUT_DIR"),
"/ebpf-turn-router-main"

View File

@@ -82,6 +82,10 @@ struct Args {
#[arg(long, env, hide = true)]
google_cloud_project_id: Option<String>,
/// Which interface to load the eBPF program onto.
#[arg(long, env, hide = true, default_value = "eth0")]
primary_interface: String,
#[command(flatten)]
health_check: http_health_check::HealthCheckArgs,
@@ -132,7 +136,7 @@ fn main() {
async fn try_main(args: Args) -> Result<()> {
setup_tracing(&args)?;
let mut ebpf = ebpf::Program::try_load("eth0")
let mut ebpf = ebpf::Program::try_load(&args.primary_interface)
.inspect_err(|e| tracing::info!("Failed to load eBPF TURN router: {e:#}"))
.ok();