# Handling IP ranges in the net module

**URL:** <https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915>\
**Category:** libs\
**Created:** [April 17, 2015, 6:39am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915 "2015-04-17T06:39:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![achanda](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/achanda/32/947_2.png) [@achanda](https://internals.rust-lang.org/u/achanda)\
**Post date:** [April 17, 2015, 6:39am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915/1 "2015-04-17T06:39:52Z")

</div>

I am pretty new to Rust. I noticed that there is no way to manipulate a range of IP addresses in Rust. I was wondering if it would make sense to add one? At the basic level, I’d expect these functionalities:

1. Support for v4 and v6
2. A way of checking if an IP belongs to that range
3. A way of getting the broadcast address and network address for that range
4. Support for combining multiple ranges etc.

I assumed that this would require a RFC. Looking for feedback on how to proceed here? Please let me know if this is worth pursuing or if it’s a bad idea 😄

---

<div class="post-metadata">

**Author:** ![seanmonstar](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/seanmonstar/32/36_2.png) [@seanmonstar](https://internals.rust-lang.org/u/seanmonstar)\
**Post date:** [April 17, 2015, 9:41am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915/2 "2015-04-17T09:41:27Z")

</div>

I’d suggest as a first step to build a crate providing the functionality you expect. They always help understanding RFCs, help tease out actual implementation details, and at the end, you still have a library that does what you wanted, regardless of the rest.

---

<div class="post-metadata">

**Author:** ![achanda](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/achanda/32/947_2.png) [@achanda](https://internals.rust-lang.org/u/achanda)\
**Post date:** [April 19, 2015, 5:51am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915/3 "2015-04-19T05:51:43Z")

</div>

Thanks for the idea. Working on it!

---

<div class="post-metadata">

**Author:** ![achanda](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/achanda/32/947_2.png) [@achanda](https://internals.rust-lang.org/u/achanda)\
**Post date:** [August 21, 2015, 6:41am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915/4 "2015-08-21T06:41:22Z")

</div>

I have a basic implementation here

> **[achanda/ipnetwork](https://github.com/achanda/ipnetwork)**
>
> A library to work with CIDRs in rust. Contribute to achanda/ipnetwork development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:24am UTC](https://internals.rust-lang.org/t/handling-ip-ranges-in-the-net-module/1915/5 "2019-03-25T08:24:19Z")

</div>

Closed on March 25, 2019, 8:24am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
