[][src]Struct ift::rfc::WithRfc6890

pub struct WithRfc6890 {
    pub entries: Vec<Rfc6890Entry>,
}

Used to check IpAddr's against all the rfc 6890 entries and find the one that matches the most specific definition

Fields

entries: Vec<Rfc6890Entry>

vector of all of the available entries

Methods

impl WithRfc6890
[src]

pub fn create() -> WithRfc6890
[src]

Build the WithRfc6890, by creating the list of Rfc6890Entry's

pub fn is_forwardable(&self, ip: &IpAddr) -> bool
[src]

RFC6890 https://tools.ietf.org/rfc/rfc6890.txt

Forwardable - A boolean value indicating whether a router may forward an IP datagram whose destination address is drawn from the allocated special-purpose address block between external interfaces.

use ift::rfc::WithRfc6890;
let rfc = WithRfc6890::create();

assert_eq!(true, rfc.is_forwardable(&"192.168.1.100".parse().unwrap()), "intranet ip");
assert_eq!(false, rfc.is_forwardable(&"169.254.169.254".parse().unwrap()), "aws metadata service");
assert_eq!(true, rfc.is_forwardable(&"172.217.9.142".parse().unwrap()), "a google ip");
assert_eq!(true, rfc.is_forwardable(&"2001:4860:4860::8844".parse().unwrap()), "a google ipv6 address");

pub fn is_global(&self, ip: &IpAddr) -> bool
[src]

RFC6890 https://tools.ietf.org/rfc/rfc6890.txt

Global - A boolean value indicating whether an IP datagram whose destination address is drawn from the allocated special-purpose address block is forwardable beyond a specified administrative domain.

use ift::rfc::WithRfc6890;
let rfc = WithRfc6890::create();

assert_eq!(false, rfc.is_global(&"192.168.1.100".parse().unwrap()), "intranet ip");
assert_eq!(true, rfc.is_global(&"192.88.99.20".parse().unwrap()), "internet ip");
assert_eq!(false, rfc.is_global(&"169.254.169.254".parse().unwrap()), "aws metadata service");
assert_eq!(true, rfc.is_global(&"172.217.9.142".parse().unwrap()), "a google ip");
assert_eq!(true, rfc.is_global(&"64:ff9b::255.255.255.255".parse().unwrap()), "ipv6");

Auto Trait Implementations

impl Send for WithRfc6890

impl Sync for WithRfc6890

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]