github.com/yggdrasil-network/yggdrasil-go@v0.5.6/src/multicast/options.go (about)

     1  package multicast
     2  
     3  import "regexp"
     4  
     5  func (m *Multicast) _applyOption(opt SetupOption) {
     6  	switch v := opt.(type) {
     7  	case MulticastInterface:
     8  		m.config._interfaces[v] = struct{}{}
     9  	case GroupAddress:
    10  		m.config._groupAddr = v
    11  	}
    12  }
    13  
    14  type SetupOption interface {
    15  	isSetupOption()
    16  }
    17  
    18  type MulticastInterface struct {
    19  	Regex    *regexp.Regexp
    20  	Beacon   bool
    21  	Listen   bool
    22  	Port     uint16
    23  	Priority uint8
    24  	Password string
    25  }
    26  
    27  type GroupAddress string
    28  
    29  func (a MulticastInterface) isSetupOption() {}
    30  func (a GroupAddress) isSetupOption()       {}