Add NAT64 (RFC 6052) embedding strategy#112
Conversation
NAT64 embedding strategy with named constructors for: well-known prefix, local-use prefix, and network-specific prefix.
Greptile SummaryAdds a
Confidence Score: 5/5This PR is safe to merge; the new strategy is self-contained and does not modify any existing code paths. The reserved-octet stitching logic in extract() and pack() was traced manually against all six prefix lengths and matches the RFC 6052 § 2.2–2.3 specification exactly. The test suite includes the RFC 6052 § 2.4 Table 1 reference vectors, non-canonical round-trip cases, and invalid-input exception paths. No existing strategy or utility code was changed. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "feature(strategy): ✨ add NAT64 (RFC 6052..." | Re-trigger Greptile |
|
Is this what you had in mind, @Roman3349? <?php
$prefix = IPv6::factory('2001:db8:122:300::');
$strategy = Nat64::networkSpecific($prefix, 56);
$ip = Multi::factory('2001:0db8:0122:03c0:0000:0221:0000:0000', $strategy);
$v4 = var_dump($ip->getDotAddress());
var_dump($v4); // string(10) "192.0.2.33"I would really appreciate it if you could review this, if you have the time next week 🙂 |
|
@zanbaldwin Yes, that's fine. The only thing is that |
|
The RFC defines any of the following CIDRs as valid: 32, 40, 48, 56, 64, or 96. Depending on the CIDR provided, the IPv4 address is embedded at different positions. (See RFC 6052 § 2.4 Table 1 for examples). @Roman3349 But yes, the convention for real-world deployments is to almost always use I'm going to merge this soon (once I figure out the best order to merge the open PRs without causing conflicts). Let me know if you have any other suggestions for future pull requests 🙂 |
NAT64 embedding strategy with named constructors for: well-known prefix, local-use prefix, and network-specific prefix.