MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _local_ipv4_addrs

Function _local_ipv4_addrs

network_diagnostics.py:126–134  ·  view source on GitHub ↗

Set of this host's IPv4 addresses (no CIDR), across all interfaces. Used to validate an mtr source ('start point') binding.

()

Source from the content-addressed store, hash-verified

124 cmd = ['ping', '-n', '-c', str(count), '-w', str(deadline)]
125 if interface:
126 if not _valid_iface(interface) or interface not in _list_iface_names(include_virtual=True):
127 return {'success': False, 'output': '', 'summary': {},
128 'error': f'Unknown interface: {interface}'}
129 cmd += ['-I', interface]
130 res = _run(cmd + [target], timeout=deadline + 5)
131 out = res['out'] or res['err']
132 summary = {}
133 m = re.search(r'(\d+) packets transmitted, (\d+) received.*?([\d.]+)% packet loss', out, re.S)
134 if m:
135 summary['transmitted'] = int(m.group(1))
136 summary['received'] = int(m.group(2))
137 summary['loss_pct'] = float(m.group(3))

Callers 1

do_mtrFunction · 0.85

Calls 4

_list_iface_namesFunction · 0.85
_iface_addrsFunction · 0.85
addMethod · 0.80
setFunction · 0.50

Tested by

no test coverage detected