From ec2601b931191dadd4e405d8576509a1ec120432 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 15 Dec 2022 10:44:00 +0100 Subject: [PATCH] detect error and startup lines --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 8aacb8b..bb8047a 100755 --- a/main.py +++ b/main.py @@ -48,10 +48,13 @@ def parse_log(log: str) -> None: def example_log() -> str: return '\n'.join( [ + '2022/09/13 15:08:36 Proxy starting', + '2022/09/13 15:08:43 NAT type: unrestricted', '2022/09/27 02:02:26 In the last 1h0m0s, there were 1 connections. Traffic Relayed ↑ 708 KB, ↓ 328 KB.', '2022/09/28 02:02:26 In the last 1h0m0s, there were 0 connections. Traffic Relayed ↑ 0 B, ↓ 0 B.', '2022/09/29 05:02:26 In the last 1h0m0s, there were 5 connections. Traffic Relayed ↑ 6 MB, ↓ 787 KB.', '2022/09/29 11:02:26 In the last 1h0m0s, there were 26 connections. Traffic Relayed ↑ 16 MB, ↓ 10 MB.', + 'sctp ERROR: 2022/09/29 23:00:53 [0xc00006e000] stream 1 not found)', ] ) @@ -96,6 +99,11 @@ class Throughput: match = pattern.match(line) if not match: + if 'sctp ERROR' in line or \ + 'Proxy starting' in line or \ + 'NAT type: ' in line: + return None + print(f'No match for this line: {line}', file=sys.stderr) return None