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