inetaf/netaddr

IPSet needs more set operations

danderson opened this issue · 1 comments

While implementing a complicated thing, I would like IPSet.Intersection(a,b) (returns a new IPSet containing only the things in both a and b). And if we're implementing one set operation, the others are probably worth having also (union, symmetric difference).

/cc @bradfitz for thoughts.

Complement too. Complement of X == IPSet(all v4 + all v6).RemoveSet(X)

union

https://godoc.org/inet.af/netaddr#IPSet.AddSet

IPSet.Intersection, symmetric difference

Intersection seems worthwhile.

Symmetric difference I'd omit and let anybody needing it add their own few line wrapper around intersection and RemoveSet.