-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upkeep/216: Add support for IPv6 #217
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Sidsector9, the code looks good. I left a couple suggestions.
It also seems like we need to update push-deploy.yml script: include composer install --no-dev
to add vendor
with the new IPLib dependency. And Looks like PHPUnit needs to be moved to require-dev
then.
composer.json
Outdated
@@ -29,6 +29,7 @@ | |||
} | |||
}, | |||
"require": { | |||
"phpunit/phpunit": "9.4.4" | |||
"phpunit/phpunit": "9.4.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it was here before, but do we really need PHPUnit in the require
and include it to the release together with IPLib?
tests/php/test-ip-addresses.php
Outdated
$this->assertTrue( $rsa::ip_in_range( '172.10.23.4', '172.10.23.*' ) ); | ||
$this->assertTrue( $rsa::ip_in_range( '172.10.23.4', '172.10.*.*' ) ); | ||
|
||
// IPv6 not in pattern range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// IPv6 not in pattern range. | |
// IPv4 not in pattern range. |
restricted_site_access.php
Outdated
|
||
if ( $parsed_range instanceof \IPLib\Range\Single ) { | ||
$in_range = $user_address->matches( $parsed_range ); | ||
} else if ( $parsed_range instanceof \IPLib\Range\Subnet || $parsed_range instanceof \IPLib\Range\Pattern ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if ( $parsed_range instanceof \IPLib\Range\Subnet || $parsed_range instanceof \IPLib\Range\Pattern ) { | |
} elseif ( $parsed_range instanceof \IPLib\Range\Subnet || $parsed_range instanceof \IPLib\Range\Pattern ) { |
2609f5d
to
93204a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #216
Description of the Change
This PR adds support for IPv6 addresses.
In addition to that, both IPv4 and IPv6 addresses can be added in the following formats:
Single address
172.10.23.4
,2001:0db8:85a3:0000:0000:8a2e:0370:7334
,2001:0db8:3333:4444::0000
, etcSubnet range
172.10.23.4/33
,2001:0db8:3333:4444:0000:0000:0000:0000/64
, etcPattern
172.10.*.5
,172.10.*.*
,2001:db8:3333:4444:5555:6666:*:*
, etcVerification Process
Checklist:
Changelog