2019-03-28 16:13:14 +00:00
|
|
|
package multicast
|
2018-05-23 10:13:53 +00:00
|
|
|
|
2018-06-12 22:50:08 +00:00
|
|
|
import (
|
2018-12-05 22:39:04 +00:00
|
|
|
"context"
|
2021-06-05 10:07:04 +00:00
|
|
|
"encoding/hex"
|
2018-06-12 22:50:08 +00:00
|
|
|
"fmt"
|
|
|
|
"net"
|
2021-05-24 02:47:12 +00:00
|
|
|
"net/url"
|
2018-06-12 22:50:08 +00:00
|
|
|
"time"
|
2018-05-23 10:13:53 +00:00
|
|
|
|
2019-09-18 15:51:46 +00:00
|
|
|
"github.com/Arceliar/phony"
|
2019-03-28 16:13:14 +00:00
|
|
|
"github.com/gologme/log"
|
|
|
|
|
2021-05-23 19:42:26 +00:00
|
|
|
"github.com/yggdrasil-network/yggdrasil-go/src/core"
|
2018-06-12 22:50:08 +00:00
|
|
|
"golang.org/x/net/ipv6"
|
|
|
|
)
|
2018-05-23 10:13:53 +00:00
|
|
|
|
2019-03-29 18:18:31 +00:00
|
|
|
// Multicast represents the multicast advertisement and discovery mechanism used
|
|
|
|
// by Yggdrasil to find peers on the same subnet. When a beacon is received on a
|
|
|
|
// configured multicast interface, Yggdrasil will attempt to peer with that node
|
|
|
|
// automatically.
|
2019-03-28 16:13:14 +00:00
|
|
|
type Multicast struct {
|
2019-09-18 15:51:46 +00:00
|
|
|
phony.Inbox
|
2021-05-23 19:42:26 +00:00
|
|
|
core *core.Core
|
2020-05-24 20:24:39 +00:00
|
|
|
log *log.Logger
|
|
|
|
sock *ipv6.PacketConn
|
2022-09-03 10:42:05 +00:00
|
|
|
_isOpen bool
|
|
|
|
_listeners map[string]*listenerInfo
|
|
|
|
_interfaces map[string]*interfaceInfo
|
2022-11-12 11:30:03 +00:00
|
|
|
_timer *time.Timer
|
2022-09-03 10:42:05 +00:00
|
|
|
config struct {
|
|
|
|
_groupAddr GroupAddress
|
|
|
|
_interfaces map[MulticastInterface]struct{}
|
|
|
|
}
|
2020-05-24 20:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type interfaceInfo struct {
|
2022-10-26 08:24:24 +00:00
|
|
|
iface net.Interface
|
|
|
|
addrs []net.Addr
|
|
|
|
beacon bool
|
|
|
|
listen bool
|
|
|
|
port uint16
|
|
|
|
priority uint8
|
2018-05-23 10:13:53 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 19:43:38 +00:00
|
|
|
type listenerInfo struct {
|
2022-09-17 19:07:00 +00:00
|
|
|
listener *core.Listener
|
2020-05-24 19:43:38 +00:00
|
|
|
time time.Time
|
2019-09-20 22:42:42 +00:00
|
|
|
interval time.Duration
|
2021-06-27 22:24:46 +00:00
|
|
|
port uint16
|
2020-05-02 21:26:41 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 18:18:31 +00:00
|
|
|
// Start starts the multicast interface. This launches goroutines which will
|
|
|
|
// listen for multicast beacons from other hosts and will advertise multicast
|
|
|
|
// beacons out to the network.
|
2022-09-03 10:42:05 +00:00
|
|
|
func New(core *core.Core, log *log.Logger, opts ...SetupOption) (*Multicast, error) {
|
|
|
|
m := &Multicast{
|
|
|
|
core: core,
|
|
|
|
log: log,
|
|
|
|
_listeners: make(map[string]*listenerInfo),
|
|
|
|
_interfaces: make(map[string]*interfaceInfo),
|
|
|
|
}
|
|
|
|
m.config._interfaces = map[MulticastInterface]struct{}{}
|
|
|
|
m.config._groupAddr = GroupAddress("[ff02::114]:9001")
|
|
|
|
for _, opt := range opts {
|
|
|
|
m._applyOption(opt)
|
|
|
|
}
|
2019-10-24 08:25:31 +00:00
|
|
|
var err error
|
|
|
|
phony.Block(m, func() {
|
|
|
|
err = m._start()
|
|
|
|
})
|
2022-09-03 10:42:05 +00:00
|
|
|
return m, err
|
2019-10-24 08:25:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Multicast) _start() error {
|
2022-09-03 10:42:05 +00:00
|
|
|
if m._isOpen {
|
2019-10-24 08:25:31 +00:00
|
|
|
return fmt.Errorf("multicast module is already started")
|
|
|
|
}
|
2022-10-22 17:05:14 +00:00
|
|
|
var anyEnabled bool
|
|
|
|
for intf := range m.config._interfaces {
|
|
|
|
anyEnabled = anyEnabled || intf.Beacon || intf.Listen
|
|
|
|
}
|
|
|
|
if !anyEnabled {
|
2019-10-24 08:54:57 +00:00
|
|
|
return nil
|
2019-10-24 08:25:31 +00:00
|
|
|
}
|
2022-09-03 11:20:57 +00:00
|
|
|
m.log.Debugln("Starting multicast module")
|
|
|
|
defer m.log.Debugln("Started multicast module")
|
2022-09-03 10:42:05 +00:00
|
|
|
addr, err := net.ResolveUDPAddr("udp", string(m.config._groupAddr))
|
2019-06-20 14:11:55 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-05-23 10:28:20 +00:00
|
|
|
}
|
2019-06-20 14:11:55 +00:00
|
|
|
listenString := fmt.Sprintf("[::]:%v", addr.Port)
|
|
|
|
lc := net.ListenConfig{
|
|
|
|
Control: m.multicastReuse,
|
|
|
|
}
|
|
|
|
conn, err := lc.ListenPacket(context.Background(), "udp6", listenString)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
m.sock = ipv6.NewPacketConn(conn)
|
2021-06-02 13:40:09 +00:00
|
|
|
if err = m.sock.SetControlMessage(ipv6.FlagDst, true); err != nil { // nolint:staticcheck
|
2019-06-20 14:11:55 +00:00
|
|
|
// Windows can't set this flag, so we need to handle it in other ways
|
|
|
|
}
|
|
|
|
|
2022-09-03 10:42:05 +00:00
|
|
|
m._isOpen = true
|
2019-06-20 14:11:55 +00:00
|
|
|
go m.listen()
|
2020-05-02 22:23:20 +00:00
|
|
|
m.Act(nil, m._multicastStarted)
|
2020-05-24 19:43:38 +00:00
|
|
|
m.Act(nil, m._announce)
|
2019-06-20 14:11:55 +00:00
|
|
|
|
2018-05-27 21:13:37 +00:00
|
|
|
return nil
|
2018-05-23 10:13:53 +00:00
|
|
|
}
|
|
|
|
|
2019-10-24 08:25:31 +00:00
|
|
|
// IsStarted returns true if the module has been started.
|
|
|
|
func (m *Multicast) IsStarted() bool {
|
2019-10-24 22:31:47 +00:00
|
|
|
var isOpen bool
|
|
|
|
phony.Block(m, func() {
|
2022-09-03 10:42:05 +00:00
|
|
|
isOpen = m._isOpen
|
2019-10-24 22:31:47 +00:00
|
|
|
})
|
|
|
|
return isOpen
|
2019-10-24 08:25:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Stop stops the multicast module.
|
2019-10-24 08:54:57 +00:00
|
|
|
func (m *Multicast) Stop() error {
|
|
|
|
var err error
|
|
|
|
phony.Block(m, func() {
|
|
|
|
err = m._stop()
|
|
|
|
})
|
|
|
|
m.log.Debugln("Stopped multicast module")
|
2019-11-30 14:05:44 +00:00
|
|
|
return err
|
2019-10-24 08:25:31 +00:00
|
|
|
}
|
|
|
|
|
2019-10-24 08:54:57 +00:00
|
|
|
func (m *Multicast) _stop() error {
|
2019-10-24 08:25:31 +00:00
|
|
|
m.log.Infoln("Stopping multicast module")
|
2022-09-03 10:42:05 +00:00
|
|
|
m._isOpen = false
|
2019-10-25 23:40:09 +00:00
|
|
|
if m.sock != nil {
|
|
|
|
m.sock.Close()
|
|
|
|
}
|
2019-10-24 08:54:57 +00:00
|
|
|
return nil
|
2019-03-28 19:09:19 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 20:24:39 +00:00
|
|
|
func (m *Multicast) _updateInterfaces() {
|
2022-09-03 10:42:05 +00:00
|
|
|
interfaces := m._getAllowedInterfaces()
|
2021-06-27 08:15:41 +00:00
|
|
|
for name, info := range interfaces {
|
|
|
|
addrs, err := info.iface.Addrs()
|
2020-05-24 20:24:39 +00:00
|
|
|
if err != nil {
|
2021-06-27 08:15:41 +00:00
|
|
|
m.log.Warnf("Failed up get addresses for interface %s: %s", name, err)
|
|
|
|
delete(interfaces, name)
|
2020-05-24 20:24:39 +00:00
|
|
|
continue
|
|
|
|
}
|
2021-06-27 08:15:41 +00:00
|
|
|
info.addrs = addrs
|
|
|
|
interfaces[name] = info
|
2020-05-24 20:24:39 +00:00
|
|
|
}
|
|
|
|
m._interfaces = interfaces
|
|
|
|
}
|
|
|
|
|
2019-06-28 23:12:56 +00:00
|
|
|
func (m *Multicast) Interfaces() map[string]net.Interface {
|
2020-05-24 20:24:39 +00:00
|
|
|
interfaces := make(map[string]net.Interface)
|
|
|
|
phony.Block(m, func() {
|
|
|
|
for _, info := range m._interfaces {
|
|
|
|
interfaces[info.iface.Name] = info.iface
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return interfaces
|
|
|
|
}
|
|
|
|
|
|
|
|
// getAllowedInterfaces returns the currently known/enabled multicast interfaces.
|
2022-09-03 10:42:05 +00:00
|
|
|
func (m *Multicast) _getAllowedInterfaces() map[string]*interfaceInfo {
|
|
|
|
interfaces := make(map[string]*interfaceInfo)
|
2018-06-08 03:07:19 +00:00
|
|
|
// Ask the system for network interfaces
|
|
|
|
allifaces, err := net.Interfaces()
|
|
|
|
if err != nil {
|
2020-10-18 16:01:18 +00:00
|
|
|
// Don't panic, since this may be from e.g. too many open files (from too much connection spam)
|
|
|
|
// TODO? log something
|
|
|
|
return nil
|
2018-06-08 03:07:19 +00:00
|
|
|
}
|
|
|
|
// Work out which interfaces to announce on
|
|
|
|
for _, iface := range allifaces {
|
2022-09-03 10:42:05 +00:00
|
|
|
switch {
|
|
|
|
case iface.Flags&net.FlagUp == 0:
|
|
|
|
continue // Ignore interfaces that are down
|
|
|
|
case iface.Flags&net.FlagMulticast == 0:
|
|
|
|
continue // Ignore non-multicast interfaces
|
|
|
|
case iface.Flags&net.FlagPointToPoint != 0:
|
|
|
|
continue // Ignore point-to-point interfaces
|
2018-06-08 03:07:19 +00:00
|
|
|
}
|
2022-09-03 10:42:05 +00:00
|
|
|
for ifcfg := range m.config._interfaces {
|
2019-03-06 11:06:13 +00:00
|
|
|
// Compile each regular expression
|
|
|
|
// Does the interface match the regular expression? Store it if so
|
2022-09-03 10:42:05 +00:00
|
|
|
if !ifcfg.Beacon && !ifcfg.Listen {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if !ifcfg.Regex.MatchString(iface.Name) {
|
|
|
|
continue
|
2018-06-08 03:07:19 +00:00
|
|
|
}
|
2022-09-03 10:42:05 +00:00
|
|
|
interfaces[iface.Name] = &interfaceInfo{
|
2022-10-26 08:24:24 +00:00
|
|
|
iface: iface,
|
|
|
|
beacon: ifcfg.Beacon,
|
|
|
|
listen: ifcfg.Listen,
|
|
|
|
port: ifcfg.Port,
|
|
|
|
priority: ifcfg.Priority,
|
2022-09-03 10:42:05 +00:00
|
|
|
}
|
|
|
|
break
|
2018-06-08 03:07:19 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-24 19:43:38 +00:00
|
|
|
return interfaces
|
|
|
|
}
|
|
|
|
|
2022-11-12 11:30:03 +00:00
|
|
|
func (m *Multicast) AnnounceNow() {
|
|
|
|
phony.Block(m, func() {
|
|
|
|
if m._timer != nil && !m._timer.Stop() {
|
|
|
|
<-m._timer.C
|
|
|
|
}
|
|
|
|
m.Act(nil, m._announce)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-05-24 19:43:38 +00:00
|
|
|
func (m *Multicast) _announce() {
|
2022-09-03 10:42:05 +00:00
|
|
|
if !m._isOpen {
|
2020-05-24 19:43:38 +00:00
|
|
|
return
|
|
|
|
}
|
2020-05-24 20:24:39 +00:00
|
|
|
m._updateInterfaces()
|
2022-09-03 10:42:05 +00:00
|
|
|
groupAddr, err := net.ResolveUDPAddr("udp6", string(m.config._groupAddr))
|
2020-05-24 19:43:38 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2022-09-03 10:42:05 +00:00
|
|
|
destAddr, err := net.ResolveUDPAddr("udp6", string(m.config._groupAddr))
|
2020-05-24 19:43:38 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
// There might be interfaces that we configured listeners for but are no
|
|
|
|
// longer up - if that's the case then we should stop the listeners
|
2022-09-03 10:42:05 +00:00
|
|
|
for name, info := range m._listeners {
|
2020-05-24 19:43:38 +00:00
|
|
|
// Prepare our stop function!
|
|
|
|
stop := func() {
|
2022-09-17 19:07:00 +00:00
|
|
|
info.listener.Close()
|
2022-09-03 10:42:05 +00:00
|
|
|
delete(m._listeners, name)
|
2020-05-24 19:43:38 +00:00
|
|
|
m.log.Debugln("No longer multicasting on", name)
|
|
|
|
}
|
|
|
|
// If the interface is no longer visible on the system then stop the
|
|
|
|
// listener, as another one will be started further down
|
2020-05-24 20:24:39 +00:00
|
|
|
if _, ok := m._interfaces[name]; !ok {
|
2020-05-24 19:43:38 +00:00
|
|
|
stop()
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
// It's possible that the link-local listener address has changed so if
|
|
|
|
// that is the case then we should clean up the interface listener
|
|
|
|
found := false
|
2023-04-06 20:45:49 +00:00
|
|
|
listenaddr, err := net.ResolveTCPAddr("tcp6", info.listener.Addr().String())
|
2020-05-24 19:43:38 +00:00
|
|
|
if err != nil {
|
|
|
|
stop()
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
// Find the interface that matches the listener
|
2020-09-27 12:16:51 +00:00
|
|
|
if info, ok := m._interfaces[name]; ok {
|
|
|
|
for _, addr := range info.addrs {
|
|
|
|
if ip, _, err := net.ParseCIDR(addr.String()); err == nil {
|
|
|
|
// Does the interface address match our listener address?
|
|
|
|
if ip.Equal(listenaddr.IP) {
|
|
|
|
found = true
|
|
|
|
break
|
2020-05-24 19:43:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the address has not been found on the adapter then we should stop
|
|
|
|
// and clean up the TCP listener. A new one will be created below if a
|
|
|
|
// suitable link-local address is found
|
|
|
|
if !found {
|
|
|
|
stop()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Now that we have a list of valid interfaces from the operating system,
|
|
|
|
// we can start checking if we can send multicasts on them
|
2020-05-24 20:24:39 +00:00
|
|
|
for _, info := range m._interfaces {
|
|
|
|
iface := info.iface
|
|
|
|
for _, addr := range info.addrs {
|
2020-05-24 19:43:38 +00:00
|
|
|
addrIP, _, _ := net.ParseCIDR(addr.String())
|
|
|
|
// Ignore IPv4 addresses
|
|
|
|
if addrIP.To4() != nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
// Ignore non-link-local addresses
|
|
|
|
if !addrIP.IsLinkLocalUnicast() {
|
|
|
|
continue
|
|
|
|
}
|
2021-06-27 22:24:46 +00:00
|
|
|
if info.listen {
|
|
|
|
// Join the multicast group, so we can listen for beacons
|
2021-06-27 08:15:41 +00:00
|
|
|
_ = m.sock.JoinGroup(&iface, groupAddr)
|
|
|
|
}
|
2021-06-27 22:24:46 +00:00
|
|
|
if !info.beacon {
|
|
|
|
break // Don't send multicast beacons or accept incoming connections
|
2021-06-27 08:15:41 +00:00
|
|
|
}
|
2020-05-24 19:43:38 +00:00
|
|
|
// Try and see if we already have a TCP listener for this interface
|
2021-06-27 22:24:46 +00:00
|
|
|
var linfo *listenerInfo
|
2023-04-06 20:45:49 +00:00
|
|
|
if _, ok := m._listeners[iface.Name]; !ok {
|
2020-05-24 19:43:38 +00:00
|
|
|
// No listener was found - let's create one
|
2021-06-27 22:24:46 +00:00
|
|
|
urlString := fmt.Sprintf("tls://[%s]:%d", addrIP, info.port)
|
2021-05-24 02:47:12 +00:00
|
|
|
u, err := url.Parse(urlString)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
if li, err := m.core.Listen(u, iface.Name); err == nil {
|
2020-05-24 19:43:38 +00:00
|
|
|
m.log.Debugln("Started multicasting on", iface.Name)
|
|
|
|
// Store the listener so that we can stop it later if needed
|
2022-04-17 16:56:54 +00:00
|
|
|
linfo = &listenerInfo{listener: li, time: time.Now(), port: info.port}
|
2022-09-03 10:42:05 +00:00
|
|
|
m._listeners[iface.Name] = linfo
|
2020-05-24 19:43:38 +00:00
|
|
|
} else {
|
|
|
|
m.log.Warnln("Not multicasting on", iface.Name, "due to error:", err)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// An existing listener was found
|
2022-09-03 10:42:05 +00:00
|
|
|
linfo = m._listeners[iface.Name]
|
2020-05-24 19:43:38 +00:00
|
|
|
}
|
|
|
|
// Make sure nothing above failed for some reason
|
2021-06-27 22:24:46 +00:00
|
|
|
if linfo == nil {
|
2020-05-24 19:43:38 +00:00
|
|
|
continue
|
|
|
|
}
|
2021-06-27 22:24:46 +00:00
|
|
|
if time.Since(linfo.time) < linfo.interval {
|
2020-05-24 19:43:38 +00:00
|
|
|
continue
|
|
|
|
}
|
2023-04-06 20:45:49 +00:00
|
|
|
addr := linfo.listener.Addr().(*net.TCPAddr)
|
|
|
|
adv := multicastAdvertisement{
|
|
|
|
PublicKey: m.core.PublicKey(),
|
|
|
|
Port: uint16(addr.Port),
|
|
|
|
}
|
|
|
|
msg, err := adv.MarshalBinary()
|
|
|
|
if err != nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
destAddr.Zone = iface.Name
|
|
|
|
if _, err = m.sock.WriteTo(msg, nil, destAddr); err != nil {
|
|
|
|
m.log.Warn("Failed to send multicast beacon:", err)
|
2020-05-24 19:43:38 +00:00
|
|
|
}
|
2021-06-27 22:24:46 +00:00
|
|
|
if linfo.interval.Seconds() < 15 {
|
|
|
|
linfo.interval += time.Second
|
2020-05-24 19:43:38 +00:00
|
|
|
}
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2022-11-12 11:30:03 +00:00
|
|
|
m._timer = time.AfterFunc(time.Second, func() {
|
2020-05-24 19:43:38 +00:00
|
|
|
m.Act(nil, m._announce)
|
|
|
|
})
|
2018-06-08 03:07:19 +00:00
|
|
|
}
|
|
|
|
|
2019-03-28 16:13:14 +00:00
|
|
|
func (m *Multicast) listen() {
|
2022-09-03 10:42:05 +00:00
|
|
|
groupAddr, err := net.ResolveUDPAddr("udp6", string(m.config._groupAddr))
|
2018-05-23 10:13:53 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
bs := make([]byte, 2048)
|
|
|
|
for {
|
2023-04-06 20:45:49 +00:00
|
|
|
n, rcm, fromAddr, err := m.sock.ReadFrom(bs)
|
2018-05-23 10:13:53 +00:00
|
|
|
if err != nil {
|
2019-10-24 08:54:57 +00:00
|
|
|
if !m.IsStarted() {
|
2019-07-06 10:52:30 +00:00
|
|
|
return
|
|
|
|
}
|
2018-05-23 10:13:53 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
if rcm != nil {
|
|
|
|
// Windows can't set the flag needed to return a non-nil value here
|
|
|
|
// So only make these checks if we get something useful back
|
|
|
|
// TODO? Skip them always, I'm not sure if they're really needed...
|
|
|
|
if !rcm.Dst.IsLinkLocalMulticast() {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if !rcm.Dst.Equal(groupAddr.IP) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
2023-04-06 20:45:49 +00:00
|
|
|
var adv multicastAdvertisement
|
|
|
|
if err := adv.UnmarshalBinary(bs[:n]); err != nil {
|
2021-06-05 10:07:04 +00:00
|
|
|
continue
|
|
|
|
}
|
2023-04-06 20:45:49 +00:00
|
|
|
if adv.PublicKey.Equal(m.core.PublicKey()) {
|
2018-05-23 10:13:53 +00:00
|
|
|
continue
|
2018-06-12 22:50:08 +00:00
|
|
|
}
|
2018-05-23 10:13:53 +00:00
|
|
|
from := fromAddr.(*net.UDPAddr)
|
2023-04-06 20:45:49 +00:00
|
|
|
from.Port = int(adv.Port)
|
2022-09-03 10:42:05 +00:00
|
|
|
var interfaces map[string]*interfaceInfo
|
2020-05-24 20:24:39 +00:00
|
|
|
phony.Block(m, func() {
|
|
|
|
interfaces = m._interfaces
|
|
|
|
})
|
2021-06-27 22:24:46 +00:00
|
|
|
if info, ok := interfaces[from.Zone]; ok && info.listen {
|
2023-04-06 20:45:49 +00:00
|
|
|
v := &url.Values{}
|
|
|
|
v.Add("key", hex.EncodeToString(adv.PublicKey))
|
|
|
|
v.Add("priority", fmt.Sprintf("%d", info.priority))
|
|
|
|
u := &url.URL{
|
|
|
|
Scheme: "tls",
|
|
|
|
Host: from.String(),
|
|
|
|
RawQuery: v.Encode(),
|
2021-05-24 02:47:12 +00:00
|
|
|
}
|
|
|
|
if err := m.core.CallPeer(u, from.Zone); err != nil {
|
2019-06-20 14:11:55 +00:00
|
|
|
m.log.Debugln("Call from multicast failed:", err)
|
|
|
|
}
|
2019-03-09 09:24:52 +00:00
|
|
|
}
|
2018-05-23 10:13:53 +00:00
|
|
|
}
|
|
|
|
}
|