Not really. Feyd did all the work.Some real teamwork is going on here. It's beautiful to watch
Okay, so I'm going to go straight to integrating this code into the library. Are you public-domain'ing this?
Moderator: General Moderators
Well, the library it's based on is LGPL as of right now, but the code posted isn't in the library, so ... I guess that's public too.ole wrote:Oh yeah Feyd, I meant to ask is that Object code with __get and __set PD? I mean, can I use it?
The only point is that if we have an IPv4 address in brackets, we have to reject it or remove the brackets. So I'm splitting out the IPv4 code so that there's differentiation.They would still have to validate the formatting, so not really.
They would beNow, if you wanted to test if the IP given is routable, then there's additionall code to add. My unit test(s) list the nonroutable masks. It wouldn't be difficult to add.
Code: Select all
10.0.0.0 - 10.255.255.255 /8
172.16.0.0 - 172.31.255.255 /12
192.168.0.0 - 192.168.255.255 /16Code: Select all
$this->AssertTrue( isValidIPv6('::/128')); // compressed, unspecified address type, non-routable
$this->AssertTrue( isValidIPv6('::1/128')); // compressed, loopback address type, non-routable
$this->AssertTrue( isValidIPv6('FE80::/10')); // compressed, link-local unicast, non-routable
$this->AssertTrue( isValidIPv6('FEC0::/10')); // compressed, site-local unicast, deprecatedYep. My final version will be effectively useless for a casual validation of an IPv6 address, but that shouldn't be too much of a problem.As for IPv4 and URI.. well, if you want to remove support for IPv4, those are in the code as $ip4 and $IPv4address in mine and the other algorithm, respectively. It's really easy to make IPv4 fail my test, change the first true to false, done.
Ah, the power of RFCs. And Feyd.I'm actually not all that well versed in the finer details of this layer of networking either. But since the idea of validating IPv6 intrigued me, I read the RFC and built what you see on the previous page.