From 0c6663d0d5335e666598807c2e5d8f105803eac0 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 9 Mar 2017 13:52:58 +1300 Subject: Enable custom options for addons - Add an options parameter to the start() event. This is to be used by addons on startup to add custom options. - Add a running() event that is called once the proxy is up and running. - With the new paradigm we can't log during master __init__, so add a tiny termstatus addon to print proxy status to terminal once we're running. --- mitmproxy/master.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mitmproxy/master.py') diff --git a/mitmproxy/master.py b/mitmproxy/master.py index 8855452c..88c64a9f 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -76,12 +76,16 @@ class Master: def run(self): self.start() + running = False try: while not self.should_exit.is_set(): # Don't choose a very small timeout in Python 2: # https://github.com/mitmproxy/mitmproxy/issues/443 # TODO: Lower the timeout value if we move to Python 3. self.tick(0.1) + if not running: + running = True + self.addons.invoke_all_with_context("running") finally: self.shutdown() -- cgit v1.2.3