pub struct PublicationConfig {
pub group: IpAddr,
pub dst_port: u16,
pub outgoing_interface: Option<OutgoingInterface>,
pub source_port: Option<u16>,
pub source_addr: Option<IpAddr>,
pub ttl: u32,
pub loopback: bool,
}Expand description
Configuration for one multicast publication socket.
Fields§
§group: IpAddrThe destination multicast group.
dst_port: u16The destination UDP port.
outgoing_interface: Option<OutgoingInterface>The explicit multicast egress interface, if set.
source_port: Option<u16>The source UDP port to bind before sending, if explicitly set.
source_addr: Option<IpAddr>The source IP address to bind before sending, if explicitly set.
ttl: u32The multicast TTL (IPv4) or hop limit (IPv6) for transmitted packets.
loopback: boolWhether outbound multicast packets should be looped back to the local host.
Implementations§
Source§impl PublicationConfig
impl PublicationConfig
Sourcepub fn new(group: impl Into<IpAddr>, port: u16) -> Self
pub fn new(group: impl Into<IpAddr>, port: u16) -> Self
Creates a basic multicast publication configuration.
Sourcepub fn family(&self) -> PublicationAddressFamily
pub fn family(&self) -> PublicationAddressFamily
Returns the address family for this publication.
Sourcepub fn validate(&self) -> Result<(), MctxError>
pub fn validate(&self) -> Result<(), MctxError>
Validates the configuration and returns an error if it is not usable.
Sourcepub fn with_outgoing_interface(
self,
outgoing_interface: impl Into<OutgoingInterface>,
) -> Self
pub fn with_outgoing_interface( self, outgoing_interface: impl Into<OutgoingInterface>, ) -> Self
Sets the multicast egress interface.
Sourcepub fn with_interface(self, interface: Ipv4Addr) -> Self
pub fn with_interface(self, interface: Ipv4Addr) -> Self
Sets the multicast egress interface using the existing IPv4-oriented convenience builder.
Sourcepub fn with_ipv6_interface_index(self, interface_index: u32) -> Self
pub fn with_ipv6_interface_index(self, interface_index: u32) -> Self
Sets the IPv6 multicast egress interface by interface index.
Sourcepub fn with_source_port(self, source_port: u16) -> Self
pub fn with_source_port(self, source_port: u16) -> Self
Sets the source UDP port.
Sourcepub fn with_source_addr(self, source_addr: impl Into<IpAddr>) -> Self
pub fn with_source_addr(self, source_addr: impl Into<IpAddr>) -> Self
Sets the exact local source address to bind before sending.
Sourcepub fn with_bind_addr(self, bind_addr: impl Into<SocketAddr>) -> Self
pub fn with_bind_addr(self, bind_addr: impl Into<SocketAddr>) -> Self
Sets the exact local address and UDP port to bind before sending.
Sourcepub fn with_loopback(self, loopback: bool) -> Self
pub fn with_loopback(self, loopback: bool) -> Self
Enables or disables multicast loopback.
Sourcepub fn ipv6_scope(&self) -> Option<Ipv6MulticastScope>
pub fn ipv6_scope(&self) -> Option<Ipv6MulticastScope>
Returns the multicast scope for the configured IPv6 group, if applicable.
Trait Implementations§
Source§impl Clone for PublicationConfig
impl Clone for PublicationConfig
Source§fn clone(&self) -> PublicationConfig
fn clone(&self) -> PublicationConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublicationConfig
impl Debug for PublicationConfig
Source§impl Hash for PublicationConfig
impl Hash for PublicationConfig
Source§impl PartialEq for PublicationConfig
impl PartialEq for PublicationConfig
Source§fn eq(&self, other: &PublicationConfig) -> bool
fn eq(&self, other: &PublicationConfig) -> bool
self and other values to be equal, and is used by ==.