Skip to main content

route_source_address

Function route_source_address 

pub fn route_source_address(destination: SocketAddr) -> Option<IpAddr>
Available on crate feature net only.
Expand description

The address the OS would send from to reach destination, without sending anything: connecting a UDP socket only sets the peer.

This answers what routing would choose, where local_addresses answers what exists. None when no route is available, or when the socket reports an unspecified address.