diff --git a/proxywatchd.py b/proxywatchd.py index 3ce90f1..c99a2cb 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -19,6 +19,12 @@ config = Config() _run_standalone = False cached_dns = dict() +regexes = { + 'www.facebook.com': 'X-FB-Debug', + 'www.reddit.com': 'x-clacks-overhead', + 'www.twitter.com': 'x-connection-hash' +} + def try_div(a, b): if b != 0: return a/float(b) return 0 @@ -150,9 +156,9 @@ class WorkerJob(): recv = sock.recv(-1) #print(recv) - regex = '^(:|NOTICE|ERROR)' if checktype == 'irc' else '(X-FB-Debug|x-clacks-overhead|x-connection-hash):' + regex = '^(:|NOTICE|ERROR)' if checktype == 'irc' else regexes[srv] # good data - if (checktype == 'irc' and re.match(regex, recv, re.IGNORECASE)) or (checktype == 'http' and re.finditer(regex, recv, re.MULTILINE)): + if re.search(regex, recv, re.IGNORECASE): duration = (time.time() - duration) if geolite and not self.country or self.country == 'unknown' or self.country == 'N/A':