Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

analyze: Group CIDRs with --group #17

Merged
merged 1 commit into from
Sep 14, 2024
Merged

analyze: Group CIDRs with --group #17

merged 1 commit into from
Sep 14, 2024

Conversation

iBug
Copy link
Collaborator

@iBug iBug commented Sep 13, 2024

Algorithm:

  • Maintain a "grouped keys" bucket
  • Start from the sorted keys list (i.e. try to group large items first), for each key:
    • Find its "adjacent part" in the "grouped" bucket
    • If found, try to group the stats recursively
    • If not found, add it unless the bucket is already at capacity, else stop

This algorithm strikes a good balance between accuracy and avoiding too many small items being grouped up into a large one unexpectedly. For example, if there are 256 /24 IPv4 ranges (within the same /16) generating 1 GB traffic and two more /24 ranges generating 100 GB each, with -n 2, the small ranges will not suddenly show up as one /16 with 256 GB traffic and surpass the more problematic ranges with 100 GB traffic.

@taoky taoky linked an issue Sep 14, 2024 that may be closed by this pull request
@taoky taoky merged commit 2a63cb9 into taoky:master Sep 14, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CIDR merger in analyze mode
2 participants