-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparison.go
34 lines (29 loc) · 941 Bytes
/
comparison.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package asn
// Equal determines if this ASN is equal to the input ASN.
func (asn ASN) Equal(other ASN) bool {
if len(asn) != len(other) {
return false
}
for i := range asn {
if asn[i] != other[i] {
return false
}
}
return true
}
// GreaterThan determines if this ASN is greater than (higher number) the input ASN.
func (asn ASN) GreaterThan(other ASN) bool {
return asn.Uint32() > other.Uint32()
}
// LessThan determines if this ASN is less than (lower number) the input ASN.
func (asn ASN) LessThan(other ASN) bool {
return asn.Uint32() < other.Uint32()
}
// GEqual determines if this ASN is greater than (higher number) or equal to the input ASN.
func (asn ASN) GEqual(other ASN) bool {
return asn.GreaterThan(other) || asn.Equal(other)
}
// LEqual determines if this ASN is less than (lower number) or equal to the input ASN.
func (asn ASN) LEqual(other ASN) bool {
return asn.LessThan(other) || asn.Equal(other)
}