Skip to content

Releases: seancfoley/ipaddress-go

Version 1.6.0

19 May 23:09
4c88618
Compare
Choose a tag to compare
  • added collection types DualIPv4v6Tries and DualIPv4v6AssociativeTries[V] for dual IPv4/v6 tries and for dual IPv4/v6 associative tries respectively
  • added Enumerate methods, the inverse of the Increment methods, to find the position of an address in a subnet, or to find the distance between two addresses
  • added Overlaps methods to check for overlapping subnets, and for checking sequential range overlap with a subnet
  • added an Increment method accepting a big.Int argument to IPv6Address and IPv6AddressSection
  • added Floor/Lower/Ceiling/Higher methods to the address trie types, similar to the existing FloorAddedNode/LowerAddedNode/CeilingAddedNode/HigherAddedNode methods
  • added the extraneous digits IPv4 parsing option allow_inet_aton_extraneous_digits
  • added ShortestPrefixMatch methods to associative tries and trie nodes
  • improved radix and bit-count validation

Download source:
go get github.com/seancfoley/ipaddress-go@v1.6.0

In your go.mod file:
require github.com/seancfoley/ipaddress-go v1.6.0

In your source:
import "github.com/seancfoley/ipaddress-go/ipaddr"

Version 1.5.5

22 Sep 02:05
10e24b2
Compare
Choose a tag to compare
  • added ShortestPrefixMatch and ShortestPrefixMatchNode methods to tries
  • performance improvements for all trie operations
  • performance improvement for sequential range containment operation
  • fix to increment method for certain IPv6 addresses with zero /64 prefix
  • fix to issue #7, separate the main functions into cmd subdirectories

Version 1.5.4

10 Mar 01:55
1359b30
Compare
Choose a tag to compare
  • fixed zero values from range keys and a couple others to match range zero values
  • made range keys smaller
  • fixed counts in IPv6v4MixedAddressGrouping

Version 1.5.3

03 Jan 03:46
fcbef75
Compare
Choose a tag to compare
  • minor adjustments to address framework interfaces to incorporate prefix lengths

Version 1.5.2

29 Nov 01:01
d2cf5f4
Compare
Choose a tag to compare
  • fixed conversion of zero-valued IPv4/6/MAC generic keys

Version 1.5.1

28 Nov 06:18
8519475
Compare
Choose a tag to compare
  • changed MappedPartition to use keys instead of pointers
  • removed inadvertent output from HostName.ToAddresses
  • godoc improvements

Version 1.5.0

27 Nov 00:41
Compare
Choose a tag to compare

Generic Types

The addition of generic types to the Go language has enabled the redefinition of certain types for this release, simplifying the code, and reducing the overall number of types. With this version there are 31 less types in total. Additionally, this version contains 18 new alias types for backwards compatibility, and 6 new generic constraint interface types, so there are actually 55 fewer concrete types than before, about a third of the previous total.

The public types that have been refactored to use generic types are: sequential ranges, iterators, tries, trie nodes, associative tries, associative trie nodes, partitions, address keys, and prefix block allocators.

For the most part, the methods and fields of the generic types are functionally equivalent with the previous non-generic versions, with a small number of exceptions.

Iterators, trie nodes, and partitions are typically not declared explicitly, instead they are typically obtained from instances of other types or function calls, avoiding type declarations. There may be backwards incompatibilities in cases where such types have been explicitly declared, but it is generally easy to discern the new generic type names to use.

Tries, associative tries, sequential ranges, address keys, and prefix block allocator types are more likely to be declared explicitly, so for those types, aliases with the previous type names have been created, to preserve backwards compatibility. These aliases also provide simpler names that avoid repeated appearance of generic type definitions in code.

Additional Functionality provided by Generics

With associative tries, you can now specify the associative value type when declaring the trie. Much like with Go maps, it is not always possible to distinguish zero-values explicitly assigned versus zero-values obtained because a value was never previously assigned. So the signature of the Get, Remap, and RemapIfAbsent methods have been changed, adding booleans which make that distinction, similar to the manner in which a boolean can be retrieved from Go map lookups to indicate whether a key was previously assigned a value in the map. For consistency, the Put method boolean return value was changed to the second return value rather than the first.

The functions AddrsMatchOrdered and AddrsMatchUnordered have been made generic. The functions are now capable of matching slices of any address type with slices of any other address type.

Integration with net/netip

This release adds the conversion methods NewIPAddressFromNetNetIPAddr, NewIPAddressFromNetNetIPPrefix,NewHostNameFromNetNetIPAddr, NewHostNameFromNetNetIPPrefix, NewHostNameFromNetNetIPAddrPort, GetNetNetIPAddr, and GetUpperNetNetIPAddr. These are long names, but the similarity in naming between packages net and net/netip required the double "Net" in the names. The type net.IPAddr has the same sequence of letters as the type netip.Addr.

A few additional backwards incompatibilities in this release

  • ToKey methods now return values and not pointers.
  • Tries of different types are no longer convertible to each other, due to the switch to generic types.
  • BlockSize and BitsForCount have been changed from functions to methods of the new type HostBitCount.
  • ParseDelimitedSegments and CountDelimitedAddresses have been changed from functions to methods of the new type DelimitedAddressString.
  • WrappedSegmentValueProviderForXXX and WrappedXXXSegmentValueProvider names have changed to use "Wrap" rather than "Wrapped" in their names

All in all, of the 37 wiki code examples, only 3 required changes due to backwards incompatibilities, all changes minor.

Version 1.4.1

21 Oct 22:03
09bf646
Compare
Choose a tag to compare
  • added the prefix block allocator
  • fixed the go.mod golang version, changed to 1.13

Download source:
go get github.com/seancfoley/ipaddress-go@v1.4.1

In your go.mod file:
require github.com/seancfoley/ipaddress-go v1.4.1

In your source:
import "github.com/seancfoley/ipaddress-go/ipaddr"

Version 1.4.0

21 Oct 21:17
fc41e54
Compare
Choose a tag to compare
  • added the prefix block allocator

Version 1.3.0

10 Oct 03:22
41bef3c
Compare
Choose a tag to compare
  • added base 85 string generation and parsing
  • added UNC literal string generation and parsing
  • added reverse DNS string parsing
  • added divisions of arbitrary bit-length
  • eliminated data races
  • expanded ContainsSize to all address items
  • fix to methods providing host masks
  • some godoc additions
  • solidified construction of division groupings