Open goodboy opened 2 years ago
found a small script that seems to work with iproute2
pretty well, slightly modified from this one:
'''
Simplest example to monitor Netlink events with a Python script.
'''
from pyroute2 import IPRSocket
from pprint import pprint
ip = IPRSocket()
ip.bind()
while True:
pprint(ip.get())
ip.close()
This issue demands a networking tool-set driven by 2 sets of requirements:
as per
ib
backend work in #321, we need an event oriented task that will request a data re-connection whenever the network status changes, usually most importantly when the user changes networks aka they are roaming.we need a set of network diagnostics tools which can generate real-time measurements that can be recorded alongside market charts to display connectivity performance per-provider.
Breakdown per bullet:
RE: Roaming
More or less the ideal UX is when a user reconnects a live running
pikerd
session, we are able to detect this and fire requests to reconnect the gateway with a faster timeout then the default :joy:.Some brief web searching says start digging in these on linux:
ip rule
stuff we need as per #329nftables
example: https://github.com/svinota/pyroute2/blob/master/examples/nftables.pyNetlink
events: https://github.com/svinota/pyroute2/blob/master/examples/iproute/ip_monitor.pyRE: connectivity metrics
A set of
trio
native network probe tools would be most ideal to be able to (dynamically) spawn tasks which record measurements using the same subsystems as FSP and data feeds. Likely we'll have to compromise to start with some kindaasyncio
lib wrapping...[ ]
mtr
is the classic tool with most of the functionality for all this: https://github.com/traviscross/mtrasyncio
based wrapper py lib: https://github.com/matt-kimball/mtr-packet-python[ ] there is the https://www.ip2location.com/ service which has free dbs for certain sets of geo data: