Documentation ¶
Overview ¶
Package processor contains processor to get CIDRs network's relation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotIPv4 = errors.New("not an IPv4 IP")
ErrNotIPv4 when given IP is not an IPv4.
Functions ¶
This section is empty.
Types ¶
type NetworkRelation ¶
type NetworkRelation string
NetworkRelation for network relations.
const ( SubsetRelation NetworkRelation = "subset" SupersetRelation NetworkRelation = "superset" DifferentRelation NetworkRelation = "different" SameRelation NetworkRelation = "same" )
Network possible relations.
type Processor ¶
type Processor struct{}
Processor check the relation between two CIDRs.
func NewProcessor ¶
func NewProcessor() *Processor
NewProcessor returns a new instance of Processor.
func (*Processor) GetOverlapRelation ¶
func (p *Processor) GetOverlapRelation(cidrA, cidrB string) (NetworkRelation, error)
GetOverlapRelation check the relation between two CIDRs The relation can be: subset: if the network of the second address is included in the first one superset: if the network of the second address includes the first one different: if the two networks are not overlapping same: if both address are in the same network Returns relation or an error if given IP is not an IPv4.