IPAddress

Java library for handling IP addresses and subnets, both IPv4 and IPv6

APACHE-2.0 License

Downloads
9
Stars
467
Committers
5

Bot releases are visible (Hide)

IPAddress - Version 4.2.0

Published by seancfoley over 6 years ago

  • better categorization of local addresses, for more consistency and for better alignment with IPv4/IPv6 standards
    • added isPrivate() method to IPv4
    • added isUnspecified() to both IPv4 and IPv6
    • added checking for local multicast addresses, both IPv4 and IPv6
    • refinement of local addresses to be more exact with isLocal(), including removal of isSiteLocal() from IPv4
  • new increment(long) method allowing for addition and subtraction outside of subnets as well as jumping into the middle of subnets rather than iterating individually
  • new mergePrefixBlocks method merges addresses and subnets into a minimal number of prefix blocks
  • new spanWithPrefixBlocks method provides the minimal set of prefix blocks that spans all addresses between any two addresses or subnets
  • added the prefixBlockIterator method which allows you to iterate through prefix block subnets rather than individual addresses, and the method getPrefixCount which counts the number of prefixes in a subnet (which matches the count for the prefix block iterator)
  • added the methods containsPrefixBlock and containsSinglePrefixBlock across all addresses and address sections to test for prefix blocks of any prefix length
  • added option to not zero out bits moving across the prefix when adjusting prefix lengths, now there is the choice of whether to zero or not, which can help with subnetting
  • parsing service names in place of port numbers with HostName, including the "*" denoting all services or ports
  • made parsing of host names with port using HostName more flexible, parsing potentially ambiguous formats involving non-bracketed IPv6 addresses and ports in more than one way, and allowing combinations of zone, prefix, and port/service
  • also added "expectPort" parsing option to handle cases in which ports are ambiguous with terminating ipv6 segments
  • allow combination of zone and prefix in ipv6 address strings (previously was supported only in HostName)
  • added zone validation to check for prefix length or port indicator
  • proper handling of encoded characters in zones inside bracketed host names
IPAddress - Version 4.1.0

Published by seancfoley almost 7 years ago

  • added sign extension for byte arrays used to construct sections and addresses, compatible with both two's complement and BigInteger byte arrays.
  • support for specifying indices into byte arrays used to construct sections and addresses
  • new methods toMaxHost and toZeroHost to get those specific single hosts from a subnet (network and broadcast address for IPv4), added new methods includesZero and includes Max. Complements existing method toPrefixBlock() which goes from address to subnet
  • changed the default toString() strings to use compression for IPv6
  • added additional validation for prefix lengths throughout the API
IPAddress - Version 4.0.0

Published by seancfoley almost 7 years ago

The main change in version 4 is a change to the way IP addresses with prefix length are handled. The old behaviour remains supported, see the doc section on prefix length handling to switch back (as simple as assigning a static field). The new behaviour is to recognize addresses with a zero host as the prefix-block subnet, while addresses with non-zero hosts are now considered individual addresses with an associated prefix length. This is consistent with common usage conventions for IPv4 and IPv6.

  • added the new prefix behaviour and prefix length handling options
  • changes to network classes and address classes to support the new prefix handling options
  • runtime exception refactoring (AddressTypeException is now AddressValueException, other new exceptions added) and added more error checking
  • added new method options to ignore IPv4 network address or IPv6 anycast address (ie the zero-host address) when iterating or getting the lowest address in a subnet
  • added new conversions to/from BigInteger, int, long
  • added intersect method
  • added toPrefixBlock method (gives prefix block for any individual address with prefix length)
  • added IPAddressSegmentSeries interface for a shared interface amongst IP addresses and address sections
  • renamed a bunch of methods (consistent with the new prefix length handling):
    isRangeEquivalentToPrefix renamed to isSinglePrefixBlock
    getEquivalentPrefix renamed to getPrefixLengthForSingleBlock
    toPrefixedEquivalent renamed to assignPrefixForSingleBlock
    isRangeUnchanged renamed to isPrefixBlock(Integer)
    getMinPrefix renamed to getMinPrefixLengthForBlock
    toMinPrefixedEquivalent renamed to assignMinPrefixForBlock
    getMaskPrefixLength renamed to getBlockMaskPrefixLength
    matchesWithPrefix renamed to matchesWithPrefixMask
    isRangeEquivalent renamed to isPrefixBlock
    isMultipleByNetworkPrefix is replaced by isSinglePrefixBlock
  • moved a few static methods:
    IPAddress.getStandardLoopbackStrings, IPAddress.getLoopback available from class IPAddressNetwork
    IPAddress.from available as IPAddressNetwork.IPAddressGenerator.from
    IPAddress.getLocalHost is removed. Instead use IPAddressNetwork.IPAddressGenerator.from on the result of InetAddress.getLocalHost().getAddress()
  • Some network object access methods have been changed. You can address default network object directly from defaultIpv4Network, defaultIpv6Network and defaultMACNetwork in class Address.

Version 4 is not backwards compatible with version 3, but migration is straightforward. Most of the API has not changed.

IPAddress - Version 2.0.2

Published by seancfoley over 7 years ago

  • get/toHostAddress in IPAddressString for getting host address of prefixed address
IPAddress - Version 3.0.0

Published by seancfoley over 7 years ago

Version 3 additions

  • MAC address support
  • MAC address integration with IPv6
  • IPv6 base 85 strings, both parsing and producing
  • parsing and producing hex strings
  • IPvx octal and binary strings
  • new address framework
  • UNC IPv6 literal strings, both parsing and producing
  • reverse DNS lookup strings, both parsing and producing
  • new reverse operations - reverse bits, bits, segments, bits per segment
  • new set of prefix and mask operations: set/apply/adjust/removePrefixLength, mask, maskNetwork, bitwiseOr, bitwiseOrNetwork
  • new set of section operations, append/prepend/replace, also getSection variants
  • parse host names with ports
  • parsing delimited segments e.g. 1,2.3.4,5,6.7
  • improved host identifier string caches
  • get/toHostAddress in IPAddressString for getting host address of prefixed address (added in v2.0.2)

Version 3 is not backwards compatible with version 2, but migration is straightforward.

No functionality has been removed. A few classes and methods have been renamed.

  • toSubnet methods replaced by mask, maskNetwork, setPrefixLength, applyPrefixLength, removePrefixLength, adjustPrefixLength.
  • IPAddressStringException is now AddressStringException
IPAddress - Version 2.0.1

Published by seancfoley over 7 years ago

fix to issue #2 NPE with mask validation options
fix to strings in certain exceptions

IPAddress - Version 2.0.0

Published by seancfoley over 7 years ago

Release 2.0.0

Requires Java 8

IPAddress - Version 1.0.0

Published by seancfoley almost 8 years ago

This release can run on Java 7

Package Rankings
Top 9.72% on Repo1.maven.org
Top 5.08% on Proxy.golang.org
Top 17.19% on Npmjs.org
Badges
Extracted from project README
Maven Central