This commit is contained in:
Adam Ierymenko 2019-09-25 13:32:46 -07:00
commit 9c37fc1a5f
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
3 changed files with 19 additions and 0 deletions

View file

@ -13,12 +13,19 @@
package zerotier
import "fmt"
// MulticastGroup represents a normal Ethernet multicast or broadcast address plus 32 additional ZeroTier-specific bits
type MulticastGroup struct {
MAC MAC
ADI uint32
}
// String returns MAC#ADI
func (mg *MulticastGroup) String() string {
return fmt.Sprintf("%s#%.8x", mg.MAC.String(), mg.ADI)
}
// Less returns true if this MulticastGroup is less than another.
func (mg *MulticastGroup) Less(mg2 *MulticastGroup) bool {
return (mg.MAC < mg2.MAC || (mg.MAC == mg2.MAC && mg.ADI < mg2.ADI))