func (d *Discoverer) StartLocal(localPort int, localMCAddr string) { if localPort > 0 { bb, err := beacon.NewBroadcast(localPort) if err != nil { l.Infof("No IPv4 discovery possible (%v)", err) } else { d.broadcastBeacon = bb go d.recvAnnouncements(bb) } } if len(localMCAddr) > 0 { mb, err := beacon.NewMulticast(localMCAddr) if err != nil { l.Infof("No IPv6 discovery possible (%v)", err) } else { d.multicastBeacon = mb go d.recvAnnouncements(mb) } } if d.broadcastBeacon == nil && d.multicastBeacon == nil { l.Warnln("No local discovery method available") } else { d.localBcastTick = time.Tick(d.localBcastIntv) d.forcedBcastTick = make(chan time.Time) go d.sendLocalAnnouncements() } }
func (d *Discoverer) StartLocal(localPort int, localMCAddr string) { if localPort > 0 { bb, err := beacon.NewBroadcast(localPort) if err != nil { if debug { l.Debugln(logPrefix, err) } l.Infoln(logPrefix, "Local discovery over IPv4 unavailable") } else { d.broadcastBeacon = bb go d.recvAnnouncements(bb) } } if len(localMCAddr) > 0 { mb, err := beacon.NewMulticast(localMCAddr) if err != nil { if debug { l.Debugln(logPrefix, err) } l.Infoln(logPrefix, "Local discovery over IPv6 unavailable") } else { d.multicastBeacon = mb go d.recvAnnouncements(mb) } } if d.broadcastBeacon == nil && d.multicastBeacon == nil { l.Warnln(logPrefix, "Local discovery unavailable") } else { d.localBcastTick = time.Tick(d.localBcastIntv) d.forcedBcastTick = make(chan time.Time) go d.sendLocalAnnouncements() } }