(include_virtual=False)
| 455 | 'server': (d.get('server') or {}).get('name'), |
| 456 | 'server_location': (d.get('server') or {}).get('location'), |
| 457 | 'isp': d.get('isp')} |
| 458 | except ValueError: |
| 459 | pass |
| 460 | return {'success': False, **meta, |
| 461 | 'error': _speedtest_error(res, meta)} |
| 462 | |
| 463 | # python speedtest-cli. To pin an interface we must bind the *device*: its |
| 464 | # own --source only sets a source address, which does not force egress (the |
| 465 | # packet still leaves via the default-route NIC wearing the other NIC's IP, |
| 466 | # and gets dropped as spoofed). speedtest_bind.py patches the socket layer |
| 467 | # with SO_BINDTODEVICE and then runs the very same client. |
| 468 | if bind: |
| 469 | wrapper = os.path.join(os.path.dirname(os.path.abspath(__file__)), |
| 470 | 'python', 'speedtest_bind.py') |
| 471 | cmd = [sys.executable or 'python3', wrapper, iface, '--json'] |
| 472 | else: |
no test coverage detected