Skip to main content

rtc_shared/ifaces/
mod.rs

1/// Platform-specific interface enumeration (FFI into the OS).
2pub mod ffi;
3pub use ffi::ifaces;
4
5#[derive(PartialEq, Eq, Debug, Clone)]
6/// The next hop configured for an interface address.
7pub enum NextHop {
8    /// The broadcast address of the attached network.
9    Broadcast(::std::net::SocketAddr),
10    /// The destination address, for point-to-point links.
11    Destination(::std::net::SocketAddr),
12}
13
14#[derive(PartialEq, Eq, Debug, Clone)]
15/// The address family or link type an [`Interface`] entry describes.
16pub enum Kind {
17    /// A raw packet-level (link layer) address.
18    Packet,
19    /// A link-layer address, such as a MAC address.
20    Link,
21    /// An IPv4 address.
22    Ipv4,
23    /// An IPv6 address.
24    Ipv6,
25    /// An address family this crate does not recognise, carrying the raw OS value.
26    Unknow(i32),
27}
28
29#[derive(Debug, Clone)]
30/// One address on one local network interface.
31///
32/// ICE gathering walks these to produce host candidates.
33pub struct Interface {
34    /// The OS name of the interface, such as `en0` or `eth0`.
35    pub name: String,
36    /// Which address family or link type this entry describes.
37    pub kind: Kind,
38    /// The address itself, if the OS reported one.
39    pub addr: Option<::std::net::SocketAddr>,
40    /// The netmask for [`Self::addr`], if the OS reported one.
41    pub mask: Option<::std::net::SocketAddr>,
42    /// The broadcast or point-to-point destination address, if any.
43    pub hop: Option<NextHop>,
44}