Skip to content

Conversation

@rvalitov
Copy link
Contributor

@rvalitov rvalitov commented Apr 25, 2025

This pull request introduces enhancements to the DefaultCache class to handle IPv6 addresses with various notations, adds new methods for IP normalization, and significantly expands test coverage to ensure correctness. The changes focus on improving cache key handling, ensuring consistent behavior for IP addresses with different notations, and extending test cases for both IPv4 and IPv6 scenarios. Supersedes and closes #78 and fixes #70 .

Enhancements to DefaultCache:

  • Improved IPv6 Handling:
    • Updated the get method to normalize and return IPv6 addresses in the same notation as the input, ensuring consistency between user input and cached data.
    • Added a new getIpAddress method to extract and normalize IP addresses from cache keys.
    • Enhanced the sanitizeName method to normalize IPv6 addresses by converting them into a standard notation and replacing forbidden characters in cache keys.

Expanded Test Coverage:

  • New Test Cases for IPv6 Handling:

    • Added tests to verify that the cache correctly handles IPv6 addresses with different notations (e.g., compressed, expanded, uppercase).
    • Introduced tests for IPv6 addresses with postfixes to ensure unique cache entries for variations.
    • Added tests to validate caching behavior for IPv6 notations, ensuring cache hits for equivalent addresses.
  • Updated Test Data:

    • Adjusted test data in testLookup and testGetBatchDetails to reflect updated data received from the API.
  • Tests For Users With Free Token:

    • Adjusted tests so that they can run for tokens with least privileges.

@rvalitov
Copy link
Contributor Author

All tests fail automatically because of outdated action upload-artifact, see #86

@max-ipinfo
Copy link
Contributor

@rvalitov please rebase your PR with the latest from master

@rvalitov rvalitov force-pushed the Fix-ipv6-notations-and-add-tests branch from 340945a to 0955f34 Compare May 14, 2025 10:55
@rvalitov
Copy link
Contributor Author

@max-ipinfo done!

@rvalitov
Copy link
Contributor Author

@max-ipinfo is it OK now?

@max-ipinfo
Copy link
Contributor

@max-ipinfo is it OK now?

Sorry @rvalitov for my latency.

I am planning on taking a final look. Once that's done, I'll approve and will submit your PR to cut a brand new release.

@max-ipinfo max-ipinfo merged commit 2daad17 into ipinfo:master Jun 20, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

Retrieving an IPV6 throw an exception

3 participants