Crate ipnet [−] [src]
Types for IPv4 and IPv6 network addresses.
This module provides types and methods for working with IPv4 and
IPv6 network addresses, commonly called IP prefixes. Its design
aligns to and makes use of the existing IpAddr
, Ipv4Addr
,
and Ipv6Addr
types provided in the Rust standard library.
The module also provides traits that extend Ipv4Addr
and
Ipv6Addr
to support Add, Sub, BitAnd, and BitOr operations, and
iteration over an IP.
Organization
IpNet
represents IP network addresses of either IPv4 or IPv6.Ipv4Net
andIpv6Net
are respectively IPv4 and IPv6 network addresses.Subnets
is an iterator that generates the valid IP network addresses bound by a given IP address range and minimum prefix length.IpAddrIter
provides iteration over a range of IP addresses.- The
IpAdd
,IpSub
,IpBitAnd
,IpBitOr
traits extend theIpv4Addr
andIpv6Addr
types with methods to perform these operations. Emu128
is an emulated 128 bit unsigned integer implemented in this module using a struct of twou64
types. This is necessary because Rust'su128
type is not yet marked stable. This can be replaced whenu128
is stable.
Structs
AddrParseError |
An error which can be returned when parsing an IP network address. |
Emu128 |
An emulated 128 bit unsigned integer. |
IpAddrIter |
An |
Ipv4Net |
An IPv4 network address. |
Ipv6Net |
An IPv6 network address. |
PrefixLenError |
An error that is returned when the prefix length is invalid. Valid prefix lengths are 0 to 32 for IPv4 and 0 to 128 for IPv6. |
Subnets |
An |
Enums
IpNet |
An IP network address, either IPv4 or IPv6. |
Traits
Contains |
Provides a |
IpAdd |
Provides a |
IpBitAnd |
Provides a |
IpBitOr |
Provides a |
IpSub |
Provides a |