Skip to main content

Gather a bunch of small adjacent networks into larger ones.

Project description

Little Fluffy Clouds: Gather a bunch of small adjacent networks into larger ones.

Sometimes you find yourself staring at a bunch of networks that look like that could be compressed if you could just kind of smoosh them together enough.

littlefluffyclouds is that smoosher.

For example, this AS has a huge number of small networks. In many cases, two /24 networks are adjacent and could be combined into a single /23. There's also a big /14 network with 252 smaller networks inside it. If you use that raw output in a command or a firewall rule, etc., then you'd have to add 7,945 networks. Wow! That's too many.

$ curl -s https://ip.guide/AS9121 | jq -r .routes.v4[]
2.17.224.0/22
2.17.228.0/22
2.17.232.0/22
2.17.236.0/22
2.20.24.0/22
23.55.52.0/22
[7,933 similar lines]
212.175.175.0/24
212.175.246.0/24
212.175.250.0/24
212.175.251.0/24
212.175.252.0/24
212.175.255.0/24

Instead, let's let littlefluffyclouds mash all those little clouds into a smaller number of big ones that cover the exact same collection of addresses:

$ uv run littlefluffyclouds $(curl -s https://ip.guide/AS9121 | jq -r .routes.v4[])
2.17.224.0/20
2.20.24.0/22
23.55.52.0/22
62.248.0.0/17
78.160.0.0/11
81.212.0.0/14
85.96.0.0/12
88.224.0.0/11
93.155.104.0/22
95.0.0.0/12
176.52.176.0/22
193.110.209.0/24
194.54.32.0/19
195.174.0.0/15
212.156.0.0/16
212.174.0.0/15

The end result is 16 networks. Sixteen. That's just about 1/500th the original size with identical address space coverage. Yay, big clouds!

API

"But I don't want to use a command line," you might say. Neither did I! littlefluffyclouds makes that easy peasy lemon squeezy!

from ipaddress import IPv4Network as I
print(gather([I('10.0.8.0/24'), I('10.0.9.0/24'), I('10.0.10.0/24'), I('10.0.11.0/24')]))

That prints [IPv4Network('10.0.8.0/22')]. Whoa! I know, right?

But... why?

Some differences with other packages which do the same thing:

  • It's often way faster. Like ridiculously faster. Think milliseconds versus minutes faster.
  • It's written with modern Python with typing and all that.
  • Its command line is optional. All the work is done in a handy API that you can call from your own project.
  • It gives correct results, even in pathological cases where little networks are intermingled with bigger ones. That case causes several other packages to only merge the big networks or the little ones, even when you could a bunch of little ones with one big one.

Version history

v0.1.0, 2025-09-17: Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

littlefluffyclouds-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

littlefluffyclouds-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file littlefluffyclouds-0.1.0.tar.gz.

File metadata

  • Download URL: littlefluffyclouds-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.16

File hashes

Hashes for littlefluffyclouds-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e1afed4418f7e646a165f8cfc25997145a4ce66a83027d864fa5a175aa1980d
MD5 99d6b4f9f49c5ebd610929ef2218d278
BLAKE2b-256 27b2fec3601323f15c24e91fe519c260dba1e33b11a013ed61162fd14350efef

See more details on using hashes here.

File details

Details for the file littlefluffyclouds-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for littlefluffyclouds-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42820c3394b654aec8ad2fec9b31279420181f944653f060b3d3d7c996b6f415
MD5 b47402f378a9bfede3c6ee2b04da5abc
BLAKE2b-256 0a274716c05f31a08287b09cf357e2f396e7f250ea73600601be6ba5ce0acc19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page