mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-30 07:21:12 -05:00
BirdLGGo: remove inaccurate "hops not responding" parsing
This commit is contained in:
parent
74521ae41f
commit
2718c09cbc
@ -7,6 +7,8 @@ First configure the following variables:
|
||||
- `plugins.birdlggo.lgserver` - point this to your looking glass server (e.g. `http://lg.highdef.dn42/`)
|
||||
- `plugins.birdlggo.nodes` - a space separated list of nodes to query. These should use internal server names (as shown in request URLs to the frontend), not the display names that the frontend shows in the navigation bar.
|
||||
|
||||
In the bird-lg-go proxy settings I recommend enabling `BIRDLG_TRACEROUTE_RAW`, as only Linux's native traceroute format is fully supported.
|
||||
|
||||
## Usage
|
||||
|
||||
Currently this provides a slimmed down UI for traceroute and BIRD's `show route`:
|
||||
|
@ -43,14 +43,10 @@ def parse_traceroute(text):
|
||||
hops.append(TraceHop(ip, ptr))
|
||||
latency = m.group("latency")
|
||||
|
||||
# bird-lg-go specific truncation
|
||||
if "hops not responding" in ''.join(notes):
|
||||
latency = None
|
||||
|
||||
return TraceResult(hops, latency, notes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
proc = subprocess.run(['traceroute', *sys.argv[1:]], encoding='utf-8', stdout=subprocess.PIPE)
|
||||
proc = subprocess.run(['traceroute', *sys.argv[1:]], check=False, encoding='utf-8', stdout=subprocess.PIPE)
|
||||
print(parse_traceroute(proc.stdout))
|
||||
|
||||
if proc.returncode:
|
||||
|
@ -123,7 +123,8 @@ traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets
|
||||
|
||||
|
||||
def testTracerouteTimedOutTruncated(self):
|
||||
# bird-lg-go specific - set latency to None in this case
|
||||
# bird-lg-go specific - ignore the "hops not responding message" since the sum
|
||||
# counts ALL hops, even those in between
|
||||
s = """
|
||||
traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets
|
||||
1 172.31.1.1 (172.31.1.1) 6.362 ms
|
||||
@ -145,7 +146,7 @@ traceroute to azure.microsoft.com (13.107.42.16), 30 hops max, 60 byte packets
|
||||
TraceHop(ip='85.10.250.209', ptr='core11.nbg1.hetzner.com'),
|
||||
TraceHop(ip='213.239.245.254', ptr='core1.fra.hetzner.com'),
|
||||
TraceHop(ip='104.44.197.103', ptr='hetzner.fra-96cbe-1a.ntwk.msn.net')],
|
||||
notes=["23 hops not responding."]), parse_traceroute(s))
|
||||
notes=["23 hops not responding."], latency="8.055 ms"), parse_traceroute(s))
|
||||
|
||||
def testTracerouteNoDNS(self):
|
||||
s = """
|
||||
|
Loading…
x
Reference in New Issue
Block a user