pub struct RoutingTable { /* private fields */ }
Expand description
A snapshot of the routing table
Implementations§
Source§impl RoutingTable
impl RoutingTable
Sourcepub async fn load_from_netstat() -> Result<Self, Error>
pub async fn load_from_netstat() -> Result<Self, Error>
Query the routing table using the netstat
command.
§Errors
Returns an error if the netstat
command fails to execute, or returns
unparseable output.
Sourcepub fn from_netstat_output(output: &str) -> Result<RoutingTable, Error>
pub fn from_netstat_output(output: &str) -> Result<RoutingTable, Error>
Generate a RoutingTable
from complete netstat output. The output should
conform to what would be returned from netstat -rn
on macOS/Darwin.
§Errors
Returns an error
Sourcepub fn find_route_entry(&self, addr: IpAddr) -> Option<&RouteEntry>
pub fn find_route_entry(&self, addr: IpAddr) -> Option<&RouteEntry>
Find the routing table entry that most-precisely matches the provided address.
pub fn default_gateways_for_netif(&self, net_if: &str) -> Option<&Vec<IpAddr>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RoutingTable
impl RefUnwindSafe for RoutingTable
impl Send for RoutingTable
impl Sync for RoutingTable
impl Unpin for RoutingTable
impl UnwindSafe for RoutingTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more