Add GCP (Google Cloud Platform) mode support
Summary
- Added support for GCP (Google Cloud Platform) subnet mode to the Visual Subnet Calculator
- GCP reserves 4 IP addresses per subnet according to their VPC documentation
- Implemented proper address calculation and validation for GCP subnets
Details
This PR adds GCP mode alongside the existing AWS, Azure, and OCI modes. According to Google Cloud VPC documentation, GCP reserves 4 addresses in each subnet:
- Network address (first address in range)
- Default gateway (second address in range)
- Reserved for future use (second-to-last address in range)
- Broadcast address (last address in range)
Changes Made:
- Added "Mode - GCP" option to the Tools dropdown menu in
dist/index.html - Implemented GCP-specific logic in
dist/js/main.js:- Set minimum subnet size to /29
- Added validation patterns for GCP mode
- Updated
subnet_usable_first()andsubnet_usable_last()functions to correctly calculate usable IP ranges - Added GCP-specific error messages with documentation links
- Added GCP mode to all relevant switch statements
- Updated
README.mdto document GCP mode and its reserved addresses
Testing
The implementation correctly:
- Enforces minimum subnet size of /29
- Reserves the first 2 and last 2 addresses in each subnet
- Displays accurate usable IP ranges when GCP mode is selected
- Shows appropriate error messages with links to GCP documentation
Test Plan
- [x] Switch to GCP mode from the Tools dropdown
- [x] Verify minimum subnet size /29 is enforced
- [x] Confirm correct calculation of usable IPs (total IPs - 4 reserved)
- [x] Test subnet splitting respects the /29 minimum
- [x] Verify error messages display correctly with working documentation links
@ckabalan can you please review this PR?
Hey thanks for your patience. I've been focusing on family the last few weeks. I'll take a look at this.
Hey thanks for your patience. I've been focusing on family the last few weeks. I'll take a look at this.
Thanks I have a copy running in my Lab but want to share with others https://visualsubnetcalc.edge.baugus-lab.com/#
Any update on this review?