Struct cni_plugin::ip_range::IpRange[][src]

pub struct IpRange {
    pub subnet: IpNetwork,
    pub range_start: Option<IpAddr>,
    pub range_end: Option<IpAddr>,
    pub gateway: Option<IpAddr>,
}

A range of IPs, usable for defining an IP pool.

The subnet is the only required field. The range can be further limited with the range_start and range_end fields, which are inclusive.

Examples

{"subnet": "10.0.0.0/8"}
{"subnet": "10.0.10.0/23", "rangeStart": "10.0.11.0", "rangeEnd": "10.0.11.254"}
{"subnet": "192.168.1.1/24", "gateway": "192.168.1.254"}

Fields

subnet: IpNetwork

The subnet for the range.

range_start: Option<IpAddr>

The start of the available range within the subnet, inclusive.

range_end: Option<IpAddr>

The end of the available range within the subnet, inclusive.

gateway: Option<IpAddr>

The gateway of the range.

Interpretation of an absent gateway is left to the implementation.

Implementations

impl IpRange[src]

pub fn iter_free(&self) -> impl Iterator<Item = (IpNetwork, &Self)>[src]

Naive implementation of iterating the IP range.

This iterator will yield every IP available in the range, that is, every IP in the subnet, except those lower than range_start, higher than range_end, or the one which is the gateway.

The current implementation iterates through the entire range and filters off the excluded IPs as per above. For IPv4 this will likely never be an issue but IPv6 ranges are monstrous and could spend a long time spinning before reaching range_start.

Trait Implementations

impl Clone for IpRange[src]

impl Debug for IpRange[src]

impl<'de> Deserialize<'de> for IpRange[src]

impl Serialize for IpRange[src]

Auto Trait Implementations

impl RefUnwindSafe for IpRange

impl Send for IpRange

impl Sync for IpRange

impl Unpin for IpRange

impl UnwindSafe for IpRange

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.