Releases: seancfoley/ipaddress-go
Version 1.7.0
- integration with the new standard library iter package introduced in Go version 1.23 without adding a dependency on Go 1.23 (required Go version remains 1.18)
- added
StdPushIterator
to convert the "pull" iterators in this library to "push" iterators, returning afunc(yield func(V) bool)
which can be assigned to a variable of the typeiter.Seq[V]
in the standard library - added
StdPullIterator
to convert the "pull" iterators in this library to iterators with API similar toiter.Pull
- added
- added
ToAddressBase
method toTrieKeyConstraint
to expose addresses from generic keys, to more easily enable generic functions on tries - added new generic helper functions
ToIPv4Slice
,ToIPv6Slice
,ToIPSlice
,ToMACSlice
andToAddressBaseSlice
for conversions of slices of addresses, address ranges, and address components - added new merge functions
MergeToPrefixBlocks
andMergeToSequentialBlocks
for combined IPv4/IPv6 merging - removed caching functionality from
ContainingFirstIterator
, use all-nodeContainingFirstAllNodeIterator
instead
Download source:
go get github.com/seancfoley/ipaddress-go@v1.7.0
In your go.mod file:
require github.com/seancfoley/ipaddress-go v1.7.0
In your source:
import "github.com/seancfoley/ipaddress-go/ipaddr"
Version 1.6.0
- added collection types
DualIPv4v6Tries
andDualIPv4v6AssociativeTries[V]
for dual IPv4/v6 tries and for dual IPv4/v6 associative tries respectively - added
Enumerate
methods, the inverse of theIncrement
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 abig.Int
argument toIPv6Address
andIPv6AddressSection
- added
Floor
/Lower
/Ceiling
/Higher
methods to the address trie types, similar to the existingFloorAddedNode
/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
Version 1.5.5
- added
ShortestPrefixMatch
andShortestPrefixMatchNode
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
- 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
- minor adjustments to address framework interfaces to incorporate prefix lengths
Version 1.5.2
- fixed conversion of zero-valued IPv4/6/MAC generic keys
Version 1.5.1
- changed MappedPartition to use keys instead of pointers
- removed inadvertent output from HostName.ToAddresses
- godoc improvements
Version 1.5.0
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
andBitsForCount
have been changed from functions to methods of the new typeHostBitCount
.ParseDelimitedSegments
andCountDelimitedAddresses
have been changed from functions to methods of the new typeDelimitedAddressString
.WrappedSegmentValueProviderForXXX
andWrappedXXXSegmentValueProvider
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
- 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
- added the prefix block allocator