2022-09-03 10:42:05 +00:00
|
|
|
package multicast
|
|
|
|
|
|
|
|
import "regexp"
|
|
|
|
|
|
|
|
func (m *Multicast) _applyOption(opt SetupOption) {
|
|
|
|
switch v := opt.(type) {
|
|
|
|
case MulticastInterface:
|
|
|
|
m.config._interfaces[v] = struct{}{}
|
|
|
|
case GroupAddress:
|
|
|
|
m.config._groupAddr = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type SetupOption interface {
|
|
|
|
isSetupOption()
|
|
|
|
}
|
|
|
|
|
|
|
|
type MulticastInterface struct {
|
2022-10-26 17:25:48 +00:00
|
|
|
Regex *regexp.Regexp
|
|
|
|
Beacon bool
|
|
|
|
Listen bool
|
|
|
|
Port uint16
|
|
|
|
Priority uint8
|
2023-10-11 18:28:28 +00:00
|
|
|
Password string
|
2022-09-03 10:42:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type GroupAddress string
|
|
|
|
|
|
|
|
func (a MulticastInterface) isSetupOption() {}
|
|
|
|
func (a GroupAddress) isSetupOption() {}
|