Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces significant updates to the
PrefixCollector
class within theirrexplorer/api/collectors.py
module, specifically aimed at refining the logic used to determine the responsible RIR/NIR for a given IP prefix. Additionally, it integrates a new NIR enum to the irrexplorer/state.py module to classify specific RIR entries that are considered National Internet Registries (NIRs).Changes
PrefixCollector Logic Update:
The method
_rir_for_prefix
has been overhauled to not only find the RIR responsible for a given prefix but also to prefer NIRs over other RIRs when applicable. This change ensures that NIRs are prioritized in the selection process, reflecting a more nuanced approach to registry classification.The previous implementation used a generator expression to filter relevant RIR statistics. The new implementation uses a more explicit loop that allows for additional checks and prioritization of NIRs.
Introduction of NIR Enum:
A new enum,
NIR
, has been added to classify specific entries as National Internet Registries. This addition allows the system to easily identify and prioritize NIRs during the RIR selection process.The
NIR
enum currently includesREGISTROBR
as a member, representing the Brazilian Internet Registry.Benefits
_rir_for_prefix
uses explicit control structures that improve the readability and maintainability of the code.Impact
This update requires careful review to ensure that the prioritization logic correctly reflects the intended behavior, especially in edge cases where multiple RIRs might overlap with a given prefix.
Additional tests may be necessary to cover the new logic paths and ensure that NIR prioritization functions as expected.
Testing
The changes have been locally tested to ensure that the new logic correctly identifies and prioritizes NIRs.
Further integration testing is recommended to validate the changes across the system.
This update aims to enhance the functionality of the IRRExplorer by refining how it identifies the responsible RIRs, ensuring that NIRs are given precedence in a manner that aligns with global internet governance practices.
Additionally, this PR resolves the issues found in Issue #308 and Issue #263, enhancing the accuracy and functionality of the IRRExplorer.
Thanks for maintaining this amazing project! =D