mjschultz / py-radix

Python radix tree implementation for IPv4 and IPv6 prefix matching.
Other
119 stars 37 forks source link

Can I get all prefixes outside contain the given? #42

Open jushao opened 4 years ago

jushao commented 4 years ago

I want to get all the prefixes that contain my given prefix. For example: rtree_roa = radix.Radix() rtree_roa.add("188.136.189.0/24") rtree_roa.add("188.136.188.0/23") rtree_roa.add("188.136.0.0/16")

When I given the prefix "188.136.189.0/24", the radix can response the list include "188.136.189.0/24", "188.136.188.0/23" and "188.136.0.0/16".

Can you add this function in class RadixTree?

clslgrnc commented 4 years ago

You are looking for search_covering https://github.com/mjschultz/py-radix/blob/52d70b050a1dcbf3a7849aa51b2420883e31539e/radix/_radix.c#L562-L567