Skip to content

Releases: futureweb/google-ip-prefix-diff-php

v2.0.0

20 Nov 16:46
2e60996
Compare
Choose a tag to compare

Release: Version 2.0.0

Released on: 2024-11-20


Changes Introduced:

  • IPv6 Integration: Extended the script to handle both IPv4 and IPv6 prefixes, allowing for comprehensive IP range processing.
  • Separate Processing Pipelines: Implemented distinct processing logic for IPv4 and IPv6 ranges to optimize performance and maintain clarity.
  • Range Merging and Sorting: Added functionality to merge and sort cloud IP ranges upfront, reducing redundancy and enhancing subtraction efficiency.
  • Optimized Bitwise Operations: Improved bitwise operations, especially for BCMath, to minimize computational overhead and speed up processing.
  • Enhanced Functionality:
    • Updated IP conversion functions to support IPv6 addresses using inet_pton and inet_ntop.
    • Refactored CIDR to range and range to CIDR conversion functions to accommodate IPv6 addressing.
  • Performance Optimizations: Streamlined loops and minimized redundant calculations to achieve faster execution times without altering output.
  • Comprehensive Documentation: Updated script comments and documentation to reflect IPv6 support and the associated changes in functionality.
  • Composer Dependencies: Updated composer.json to include dependencies for PHP extensions GMP and BCMath, along with scripts to enforce their presence.

Impact:

  • Extended Compatibility: Users can now utilize the script for environments requiring IPv6 alongside IPv4, ensuring broader applicability.
  • Improved Efficiency: Performance optimizations lead to quicker processing times, especially when dealing with large sets of IP ranges.
  • Maintainability: Clear separation of IPv4 and IPv6 logic enhances code readability and ease of future maintenance.

Performance Improvements:

  • Execution Speed: The script now executes in under 500ms with GMP Ext installed on our test server, a significant improvement from the original Python script's 1.5 seconds for the same task. This enhancement ensures faster IP range calculations, making the script more efficient and responsive.

Prerequisites:

  • PHP Extensions: Continues to require either the PHP GMP or BCMath extension, with GMP being preferred for optimal performance.

Full Changelog: https://github.com/futureweb/google-ip-prefix-diff-php/blob/main/CHANGELOG.md

v1.0.1

20 Nov 12:44
b0bd486
Compare
Choose a tag to compare

New Feature: Direct CLI Output

This release introduces the ability for the script to output the calculated IP prefixes directly to the CLI when executed from the command line.

What's New?

  • When the script is run via CLI (php google_ip_prefix_diff.php), it now outputs the resulting IP prefixes (CIDR blocks) line by line.
  • This makes it easier to redirect the output to a file for caching or further processing:
    php google_ip_prefix_diff.php > cached_ip_ranges.txt

Benefits:

  • Automation-Friendly: Enables easy integration with cron jobs or other automation tools.
  • Improved Usability: Users no longer need to manually handle the returned array when running the script via CLI.

Example CLI Usage:

php google_ip_prefix_diff.php

Output:

8.8.8.0/24
8.8.4.0/24
203.0.113.0/25
php google_ip_prefix_diff.php > cached_ip_ranges.txt

This saves the output to cached_ip_ranges.txt, which can be reused in your application.

v1.0.0

20 Nov 11:02
174f0f9
Compare
Choose a tag to compare

Initial Release