2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-10 19:46:26 +00:00

Add a quick utility function to just use ipv6 multicast to get all possible local peers.

This commit is contained in:
Jarrod Johnson
2026-09-09 15:18:35 -04:00
parent 55b1786a68
commit af36db4824
+11
View File
@@ -165,6 +165,17 @@ async def mac2ip(mac):
return lla
async def ping_everywhere():
pingtasks = []
pingresponders = {}
for interface in list_viable_nics():
async def ping_task(iface):
addrs = await ping6('ff02::1', interface=iface, multi=True)
pingresponders[iface] = addrs
pingtasks.append(ping_task(interface))
await asyncio.gather(*pingtasks)
return pingresponders
async def ping6(target, interface=None, multi=False):
# Do an IPv6 ping. Notably interesting target is ff02::1, to induce all local
# peers to transmit a reply