From 113a448b78d5814cff4c11b905d0f96e89e5f548 Mon Sep 17 00:00:00 2001 From: anders-avos Date: Sun, 17 Nov 2024 23:37:31 +0100 Subject: [PATCH] turn: Add relay_addr to AllocationInfo (#630) --- turn/src/allocation/allocation_manager.rs | 1 + turn/src/allocation/mod.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/turn/src/allocation/allocation_manager.rs b/turn/src/allocation/allocation_manager.rs index 4b063285c..9c0241631 100644 --- a/turn/src/allocation/allocation_manager.rs +++ b/turn/src/allocation/allocation_manager.rs @@ -63,6 +63,7 @@ impl Manager { AllocationInfo::new( *five_tuple, alloc.username.text.clone(), + alloc.relay_addr, #[cfg(feature = "metrics")] alloc.relayed_bytes.load(Ordering::Acquire), ), diff --git a/turn/src/allocation/mod.rs b/turn/src/allocation/mod.rs index 4363fdc7d..91537ef44 100644 --- a/turn/src/allocation/mod.rs +++ b/turn/src/allocation/mod.rs @@ -45,6 +45,9 @@ pub struct AllocationInfo { /// Username of this [`Allocation`]. pub username: String, + /// Relay address of this [`Allocation`]. + pub relay_addr: SocketAddr, + /// Relayed bytes with this [`Allocation`]. #[cfg(feature = "metrics")] pub relayed_bytes: usize, @@ -55,11 +58,13 @@ impl AllocationInfo { pub fn new( five_tuple: FiveTuple, username: String, + relay_addr: SocketAddr, #[cfg(feature = "metrics")] relayed_bytes: usize, ) -> Self { Self { five_tuple, username, + relay_addr, #[cfg(feature = "metrics")] relayed_bytes, } @@ -255,6 +260,7 @@ impl Allocation { .send(AllocationInfo { five_tuple: self.five_tuple, username: self.username.text.clone(), + relay_addr: self.relay_addr, #[cfg(feature = "metrics")] relayed_bytes: self.relayed_bytes.load(Ordering::Acquire), })