Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Open
jushao opened this issue Oct 30, 2019 · 1 comment
Open

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

jushao opened this issue Oct 30, 2019 · 1 comment

Comments

@jushao
Copy link

jushao commented Oct 30, 2019

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?

@jushao jushao changed the title Can I get all prefixes contain the given? Can I get all prefixes outside contain the given? Oct 30, 2019
@clslgrnc
Copy link

You are looking for search_covering

py-radix/radix/_radix.c

Lines 562 to 567 in 52d70b0

PyDoc_STRVAR(Radix_search_covering_doc,
"Radix.search_covering(network[, masklen][, packed] -> List of RadixNode\n\
\n\
Returns a list of nodes with a less specific or same prefix than network.\n\
\n\
If no match is found, then returns an empty list.");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants