mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Priority support (#964)
* Allow setting link priorities * Fix a bug * Allow setting priority on listeners and multicast interfaces * Update `yggdrasilctl` * Update to Arceliar/ironwood#5
This commit is contained in:
parent
9a9452dcc8
commit
f08dec822a
14 changed files with 79 additions and 56 deletions
|
@ -37,11 +37,12 @@ type Multicast struct {
|
|||
}
|
||||
|
||||
type interfaceInfo struct {
|
||||
iface net.Interface
|
||||
addrs []net.Addr
|
||||
beacon bool
|
||||
listen bool
|
||||
port uint16
|
||||
iface net.Interface
|
||||
addrs []net.Addr
|
||||
beacon bool
|
||||
listen bool
|
||||
port uint16
|
||||
priority uint8
|
||||
}
|
||||
|
||||
type listenerInfo struct {
|
||||
|
@ -194,10 +195,11 @@ func (m *Multicast) _getAllowedInterfaces() map[string]*interfaceInfo {
|
|||
continue
|
||||
}
|
||||
interfaces[iface.Name] = &interfaceInfo{
|
||||
iface: iface,
|
||||
beacon: ifcfg.Beacon,
|
||||
listen: ifcfg.Listen,
|
||||
port: ifcfg.Port,
|
||||
iface: iface,
|
||||
beacon: ifcfg.Beacon,
|
||||
listen: ifcfg.Listen,
|
||||
port: ifcfg.Port,
|
||||
priority: ifcfg.Priority,
|
||||
}
|
||||
break
|
||||
}
|
||||
|
@ -387,7 +389,7 @@ func (m *Multicast) listen() {
|
|||
})
|
||||
if info, ok := interfaces[from.Zone]; ok && info.listen {
|
||||
addr.Zone = ""
|
||||
pin := fmt.Sprintf("/?key=%s", hex.EncodeToString(key))
|
||||
pin := fmt.Sprintf("/?key=%s&priority=%d", hex.EncodeToString(key), info.priority)
|
||||
u, err := url.Parse("tls://" + addr.String() + pin)
|
||||
if err != nil {
|
||||
m.log.Debugln("Call from multicast failed, parse error:", addr.String(), err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue