NAME

Net::Hacky::Detect::IP - Hackily try different methods of attaining local system IPs

VERSION

Version 0.018

SYNOPSIS

use Net::Hacky::Detect::IP;
my $ip = Net::Hacky::Detect::IP->new();

my @ips = @{ $ip->scan() };

foreach my $host (@ips) {
    print "Detected ip: $host\n";
    if ($ip->checkIP($host)) {
        print "IP is deffinetly usable! (Was tested twice as scan() auto checks)\n";
    }
}

DESCRIPTION

Hackily concatenate output from multiple system commands then attempt to find valid ips from it, once found they are tested for connectability then returned. This is not pretty nor very clever but extracting system ips is a nightmare however you go about it and this method appears to be the more reliable.

METHODS

new

Create a new object for interacting with Net-Hacky-Detect-IP

scan

Attempt to find local system ips, 1 optional argument, of '4' or '6' designating wether to look for ipv4 or ipv6 addresses, if left blank search for both.

Returns a list of local ips for the system, will return a blank [] list if nothing found.

checkIP

Check an IP is valid and usable, takes 1 mandatory argument;

Argument 1 Should be an ip address (not hostname)

Returns 1 on success 'valid' and 0 on failure 'invalid'

is_public

Return 1 if an address is a publically routed address.

Return 0 if it is not.

is_private

Return 1 if an address is a privately routed 'LAN' address.

Return 0 if it is not.

is_outbound

Return 1 if an address can be bound to, to access the internet.

Return 0 if it is not.

AUTHOR

Paul G Webster, <daemon at cpan.org>

BUGS

Please report any bugs or feature requests through the authors code repository at https://gitlab.com/paul-g-webster/PL-Net-Hacky-Detect-IP

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::Hacky::Detect::IP

You can also look for information at:

ACKNOWLEDGEMENTS

Thank you for all the continued help from irc.freenode.net #perl and irc.perl.org #perl

LICENSE AND COPYRIGHT

Copyright 2017 Paul G Webster.

This program is distributed under the (Simplified) BSD License: http://www.opensource.org/licenses/BSD-2-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.