ipnet
Provides types and useful methods for working with IPv4 and IPv6 network addresses, commonly called IP prefixes. The new `IpNet`, `Ipv4Net`, and `Ipv6Net` types build on the existing `IpAddr`, `Ipv4Addr`, and `Ipv6Addr` types already provided in Rust's standard library and align to their design to stay consistent. The module also provides useful traits that extend `Ipv4Addr` and `Ipv6Addr` with methods for `Add`, `Sub`, `BitAnd`, and `BitOr` operations. The module only uses stable feature so it is guaranteed to compile using the stable toolchain.
2.12.1
536M downloads/mo
#188 most downloaded on crates.io
krisprice/ipnet
What this package is like to depend on
Last release 21 days ago
02 Aug 2026
Release timing varies
gaps range from 4 weeks to 1.1 years
Some releases are documented
notes for 21 of 68 stable releases
1 version withdrawn
withdrawn after publishing
9 years old
71 releases · first in 2017
2 releases in the last 12 months
see the full history below
Release timeline
71 releases · Aug 2017 to Aug 2026Releases
latest 60 of 71-
2.12.102 Aug 2026Release notes
Open source →- Fixes bug where Ipv4Subnets(0.0.0.0, u32::MAX-1, 0) and Ipv6Subnets(::, u128::MAX-1, 0) incorrectly included u32::MAX and u128::MAX. See issue #70.
- Fixes some typos in documentation and error messages
-
2.12.003 Mar 2026Release notes
Open source →- Backwards compatible schemars 1.* support using version specific features#67
-
2.11.020 Jan 2025 -
2.10.103 Oct 2024 -
2.10.007 Sep 2024Release notes
Open source →- Add new_assert implementations #57
- Remove redundant curly braces so that the example program can compile #53
-
2.9.022 Oct 2023 -
2.8.026 Jun 2023 -
2.7.227 Mar 2023Release notes
Open source →- Inline constructors and field getters #48
- Use Serializer::collect_str to serialize output of Display #39
-
2.7.108 Jan 2023 -
2.7.011 Dec 2022 -
2.6.007 Dec 2022Release notes
Open source →- Add IP netmask to prefix conversion functions and new
with_netmask()constructors.
- Add IP netmask to prefix conversion functions and new
-
2.5.106 Nov 2022Nothing published for this version
-
2.5.016 Apr 2022Release notes
Open source →- Manually implement JsonSchema for IpNet, Ipv4Net, Ipv6Net #41 because default derived JsonSchema does not correspond to Serde representation #40
- Migrate to edition 2018
-
2.4.006 Mar 2022Release notes
Open source →- Add 'schemars' feature for deriving JSON schema #31
- add convenience IpNet::new method #36
-
2.3.115 Jun 2021 -
2.3.016 Mar 2020Release notes
Open source →-
Merge @imp's
Defaultimplementation. See #18.Ipv4NetandIpv6Netnow default to 0.0.0.0/0 and ::/0 respectively.IpNetdefaults to the 0/0Ipv4Net. -
Add
#[allow(arithmetic_overflow)]forIpv4AddrRange::count()andIpv6AddrRange::count(). Since 1.43.0-nightly it gives a build error but this panic behavior is desired. In future it may be replaced with explicit use ofpanic!. See #21.
-
-
2.2.002 Feb 2020Release notes
Open source →- Implement
From<IpAddr>,From<Ipv4Addr>, andFrom<Ipv6Addr>forIpNet,Ipv4Net, andIpv6Netrespectively.
- Implement
-
2.1.008 Nov 2019Release notes
Open source →-
Implement
FusedIteratorforIpAddrRange,Ipv4AddrRange,Ipv6AddrRange,IpSubnets,Ipv4Subnets, andIpv6Subnets. -
Implement
DoubleEndedIteratorforIpAddrRange,Ipv4AddrRange,Ipv6AddrRange. -
Implement custom
count(),last(),max(),min(),nth(), andsize_hint()forIpAddrRange,Ipv4AddrRange,Ipv6AddrRange.
-
-
2.0.112 Oct 2019Release notes
Open source →-
Fix bug where IpAddrRange never ends when start and end are both 0 #11
-
Fix warning about missing 'dyn'
-
-
2.0.022 Aug 2018Release notes
Open source →-
The
Emu128module has been removed. This provided an emulated 128-bit integer for supporting IPv6 addresses. As of Rust 1.26 the built-in 128-bit integers have been marked stable and this library has been updated to use these instead ofEmu128. -
The
with-serdefeature name shim has been removed. Theserdefeature should now be used using the bareserdefeature name per the Rust API Guidelines. -
The
DerefonIpv4NetandIpv6Nethas been removed. This dereferenced to theIpv4AddrandIpv6Addrcontained in the type. To use these methods call them directly on the contained IP address of interest, which may be accessed using theaddr()ornetwork()methods. -
In prior versions it was necessary to use the
Containstrait to access thecontains()methods. These are now inherited in public methods on theIpNet,Ipv4Net, andIpv6Nettypes so are always available. -
The implementations of
IpAdd<u32>andIpSub<u32>for IpAddr have been removed. -
The implementations of
IpAdd<u32>andIpSub<u32>forIpv6Addrhave been removed.
-
-
2.0.0-rc127 Jul 2018 pre-releaseNothing published for this version
-
1.2.107 Jun 2018Release notes
Open source →- Fix to resolve an issue with the optional serde support, where compact binary formats were not properly supported. See issue #10.
-
1.2.017 Apr 2018Release notes
Open source →- The previous release (1.1.0) introduced serde support using the feature name
with-serde, but the Rust API Guidelines recommend usingserdeas the name of the feature. This release changes the feature name fromwith-serdetoserde, but it is backwards compatible for those that already started using thewith-serdefeature name. The 1.1.0 release was yanked on crates.io to discourage further use of this feature name. See pull request #7.
- The previous release (1.1.0) introduced serde support using the feature name
-
1.1.013 Apr 2018 withdrawn -
1.0.003 Oct 2017Nothing published for this version
-
1.0.0-rc102 Oct 2017 pre-releaseNothing published for this version
-
0.28.121 Sep 2017Nothing published for this version
-
0.28.021 Sep 2017Nothing published for this version
-
0.27.014 Sep 2017Nothing published for this version
-
0.26.512 Sep 2017Nothing published for this version
-
0.26.404 Sep 2017Nothing published for this version
-
0.26.304 Sep 2017Nothing published for this version
-
0.26.203 Sep 2017Nothing published for this version
-
0.26.102 Sep 2017Nothing published for this version
-
0.26.002 Sep 2017Nothing published for this version
-
0.25.101 Sep 2017Nothing published for this version
-
0.25.001 Sep 2017Nothing published for this version
-
0.24.301 Sep 2017Nothing published for this version
-
0.24.231 Aug 2017Nothing published for this version
-
0.24.131 Aug 2017Nothing published for this version
-
0.24.031 Aug 2017Nothing published for this version
-
0.23.131 Aug 2017Nothing published for this version
-
0.23.028 Aug 2017Nothing published for this version
-
0.22.028 Aug 2017Nothing published for this version
-
0.21.128 Aug 2017Nothing published for this version
-
0.21.028 Aug 2017Nothing published for this version
-
0.20.128 Aug 2017Nothing published for this version
-
0.20.028 Aug 2017Nothing published for this version
-
0.19.023 Aug 2017Nothing published for this version
-
0.18.323 Aug 2017Nothing published for this version
-
0.18.223 Aug 2017Nothing published for this version
-
0.18.123 Aug 2017Nothing published for this version
-
0.18.023 Aug 2017Nothing published for this version
-
0.17.122 Aug 2017Nothing published for this version
-
0.17.022 Aug 2017Nothing published for this version
-
0.16.222 Aug 2017Nothing published for this version
-
0.16.122 Aug 2017Nothing published for this version
-
0.16.020 Aug 2017Nothing published for this version
-
0.15.320 Aug 2017Nothing published for this version
-
0.15.220 Aug 2017Nothing published for this version