AddAddress is called when a new endpoint is added
(ipv6 netip.Addr)
| 42 | |
| 43 | // AddAddress is called when a new endpoint is added |
| 44 | func (mgr *MCastManager) AddAddress(ipv6 netip.Addr) { |
| 45 | if mgr.iface == "" || !ipv6.IsValid() { |
| 46 | return |
| 47 | } |
| 48 | |
| 49 | key := multicast.Address(ipv6).Key() |
| 50 | |
| 51 | mgr.mutex.Lock() |
| 52 | defer mgr.mutex.Unlock() |
| 53 | |
| 54 | if _, ok := mgr.addresses[key]; !ok { |
| 55 | // First IP that has the solicited node maddr |
| 56 | mgr.joinGroup(ipv6) |
| 57 | mgr.addresses[key] = map[netip.Addr]struct{}{} |
| 58 | } |
| 59 | |
| 60 | mgr.addresses[key][ipv6] = struct{}{} |
| 61 | } |
| 62 | |
| 63 | // RemoveAddress is called when an endpoint is removed |
| 64 | func (mgr *MCastManager) RemoveAddress(ipv6 netip.Addr) { |