Skip to content

Commit

Permalink
Provide an IPv4-only default socket for mdns (#51)
Browse files Browse the repository at this point in the history
And mention that dual-stack and single-stack implementations exist
  • Loading branch information
lu-zero authored Nov 30, 2024
1 parent 2924d35 commit 426847c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions edge-mdns/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ use log::{debug, warn};

use super::*;

/// A quick-and-dirty socket address that binds to a "default" interface.
/// Socket address that binds to any IPv4-configured interface available
pub const IPV4_DEFAULT_SOCKET: SocketAddr =
SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), PORT);

/// Socket address that binds to any IPv6-configured interface available on single-stack
/// implementations and to any configured interface available on dual-stack implementations.
pub const IPV6_DEFAULT_SOCKET: SocketAddr =
SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), PORT);

/// A quick-and-dirty socket address that binds to any interface available on dual-stack
/// implementations.
/// Don't use in production code.
pub const DEFAULT_SOCKET: SocketAddr = SocketAddr::new(IpAddr::V6(Ipv6Addr::UNSPECIFIED), PORT);
pub const DEFAULT_SOCKET: SocketAddr = IPV6_DEFAULT_SOCKET;

/// The IPv4 mDNS broadcast address, as per spec.
pub const IP_BROADCAST_ADDR: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 251);
Expand Down

0 comments on commit 426847c

Please sign in to comment.