mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-30 07:05:06 +03:00
Store interface info
This commit is contained in:
parent
de06b4656a
commit
53ab715fb4
1 changed files with 10 additions and 2 deletions
|
@ -32,6 +32,9 @@ func (m *Multicast) _multicastStarted() {
|
||||||
go func() {
|
go func() {
|
||||||
defer fmt.Println("No longer listening for netlink changes")
|
defer fmt.Println("No longer listening for netlink changes")
|
||||||
for {
|
for {
|
||||||
|
current := m.config.GetCurrent()
|
||||||
|
exprs := current.MulticastInterfaces
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case change := <-linkChanges:
|
case change := <-linkChanges:
|
||||||
attrs := change.Attrs()
|
attrs := change.Attrs()
|
||||||
|
@ -56,8 +59,13 @@ func (m *Multicast) _multicastStarted() {
|
||||||
if add {
|
if add {
|
||||||
m.Act(nil, func() {
|
m.Act(nil, func() {
|
||||||
fmt.Println("Link added:", attrs.Name)
|
fmt.Println("Link added:", attrs.Name)
|
||||||
if intf, err := net.InterfaceByName(attrs.Name); err == nil {
|
if iface, err := net.InterfaceByName(attrs.Name); err == nil {
|
||||||
m._interfaces[attrs.Name] = intf
|
if addrs, err := iface.Addrs(); err == nil {
|
||||||
|
m._interfaces[attrs.Name] = interfaceInfo{
|
||||||
|
iface: iface,
|
||||||
|
addrs: addrs,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue