piker
piker copied to clipboard
Roaming support, general real-time network measurements
This issue demands a networking tool-set driven by 2 sets of requirements:
-
as per
ibbackend 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:
- https://github.com/svinota/pyroute2
- btw this is probably useful for the
ip rulestuff we need as per #329 nftablesexample: https://github.com/svinota/pyroute2/blob/master/examples/nftables.py- also see the website
- example for monitoring
Netlinkevents: https://github.com/svinota/pyroute2/blob/master/examples/iproute/ip_monitor.py
- btw this is probably useful for the
- https://github.com/seveas/python-networkmanager
RE: 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 kinda asyncio lib wrapping...
-
[ ]
mtris the classic tool with most of the functionality for all this: https://github.com/traviscross/mtr- [ ] there's a
asynciobased wrapper py lib: https://github.com/matt-kimball/mtr-packet-python
- [ ] there's a
-
[ ] there is the https://www.ip2location.com/ service which has free dbs for certain sets of geo data:
- docs on the free dbs:
- https://lite.ip2location.com/database/ip-country
- https://lite.ip2location.com/database/px1-ip-country
- their GH org: https://github.com/ip2location
- a traceroute tool with python impl: https://www.ip2location.com/free/traceroute-application
- official GH lib: https://github.com/ip2location/ip2trace-python
- 3rd party foss client which levers the free dbs: https://github.com/chrislim2888/IP2Location-Python
- docs on the free dbs:
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()