Feature request: IPNetwork Subtract
See original GitHub issueLooking at the source code, I see a method called: TrySubstractNetwork
. I attempted to use a slightly modified version of this function and it was extremely slow.
I am trying to take two lists IncludedRanages
and ExcludedRanges
and have something consolidate adjacent and overlapping ranges/networks. Is this something easily added?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Issues · lduchosal/ipnetwork
IPNetwork command line and C# library take care of complex network, IP, IPv4, IPv6, netmask, ... Feature request: IPNetwork Subtract enhancement help wanted....
Read more >How to diff a range of IP addresses within ...
Given an IP range, how can code to subtract an IP address or IP address range from that range? Example 1: original_range =...
Read more >netaddr Documentation
IPNetwork objects are used to represent subnets, networks or VLANs ... Please raise bugs and feature requests against this as you find them....
Read more >Source code for netaddr.ip
[docs] def __sub__(self, num): """ Subtract the numerical value of this IP address from num providing the result as a new IPAddress object....
Read more >FREE Advanced Subnet Calculator - IP Calculator
Handy and easy-to-use Subnet Calculator. Use our FREE online Subnet Calculator to create lists of addresses for subnets.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@RobThree thanks, I’ll dig into your proposal.
Exactly. This is how it’s supposed to be done and can be very fast since all you do is split recursively. I have implemented the algorithm here (disclaimer, stating the obvious: author here).
For an example:
You can also pass “0.0.0.0/28” to ‘extract’ any /28 from the given network. Works with IPv6 as well. What may help is using a visual subnet calculator like this one (no affiliation) to help visualize the concept. @lduchosal’s exampe would be done as: