Merge pull request #178 from dkerr64/RemoveValidateIP

Remove dependency on Data::Validate::IP
This commit is contained in:
Richard Hansen 2020-06-15 23:19:03 -04:00 committed by GitHub
commit 5b251f3802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -8,6 +8,7 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
### New features
* Added support for OVH DynHost.
* Removed dependency on Data::Validate::IP.
### Compatibility changes

View file

@ -46,7 +46,6 @@ through github.com. Please check out http://ddclient.net
- one or more accounts from one of the dynamic DNS services
- Perl v5.10.1 or later
- `Data::Validate::IP` perl library
- `IO::Socket::SSL` perl library for ssl-support
- `JSON::PP` perl library for JSON support
- `IO::Socket:INET6` perl library for ipv6-support

View file

@ -24,7 +24,6 @@ use warnings;
use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
use Data::Validate::IP;
my $version = "3.9.1";
my $programd = $0;
@ -2306,6 +2305,15 @@ sub get_ip {
return $ip;
}
######################################################################
## is_ipv6() validates if string is valid IPv6 address
######################################################################
sub is_ipv6 {
my ($value) = @_;
# This little gem from http://home.deds.nl/~aeron/regex/
return $value =~ /^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})\z/ai;
}
######################################################################
## ipv6_match determine ipv6 address from given string and return them
######################################################################