| 79 | } |
| 80 | |
| 81 | func (mod *Discovery) runDiff(cache network.ArpTable) { |
| 82 | // check for endpoints who disappeared |
| 83 | var rem network.ArpTable = make(network.ArpTable) |
| 84 | |
| 85 | mod.Session.Lan.EachHost(func(mac string, e *network.Endpoint) { |
| 86 | if _, found := cache[mac]; !found { |
| 87 | rem[mac] = e.IpAddress |
| 88 | } |
| 89 | }) |
| 90 | |
| 91 | for mac, ip := range rem { |
| 92 | mod.Session.Lan.Remove(ip, mac) |
| 93 | } |
| 94 | |
| 95 | // now check for new friends ^_^ |
| 96 | for ip, mac := range cache { |
| 97 | mod.Session.Lan.AddIfNew(ip, mac) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | func (mod *Discovery) Configure() error { |
| 102 | return nil |