aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-26 20:08:24 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-26 20:08:24 +1200
commitad893ad134cdc03f9152548e39a1dbce896cbee4 (patch)
tree7cfb2af636cdc86d4974b32b4e5be5cad587d0d3 /libmproxy/proxy.py
parent8ccfb376f34a66dfc591e8ffa0307810f588937c (diff)
downloadmitmproxy-ad893ad134cdc03f9152548e39a1dbce896cbee4.tar.gz
mitmproxy-ad893ad134cdc03f9152548e39a1dbce896cbee4.tar.bz2
mitmproxy-ad893ad134cdc03f9152548e39a1dbce896cbee4.zip
Transparent proxy command-line flag stub.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index bdd71e19..3ab93790 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -379,6 +379,8 @@ def certificate_option_group(parser):
parser.add_option_group(group)
+TRANSPARENT_SSL_PORTS = [443, 8443]
+
def process_proxy_options(parser, options):
if options.cert:
options.cert = os.path.expanduser(options.cert)
@@ -393,6 +395,17 @@ def process_proxy_options(parser, options):
options.cache = os.path.expanduser(options.cache)
body_size_limit = utils.parse_size(options.body_size_limit)
+ if options.reverse_proxy and options.transparent_proxy:
+ parser.errror("Can't set both reverse proxy and transparent proxy.")
+
+ if options.transparent_proxy:
+ trans = dict(
+ resolver = None,
+ sslports = TRANSPARENT_SSL_PORTS
+ )
+ else:
+ trans = None
+
if options.reverse_proxy:
rp = utils.parse_proxy_spec(options.reverse_proxy)
if not rp:
@@ -412,5 +425,6 @@ def process_proxy_options(parser, options):
cert_wait_time = options.cert_wait_time,
body_size_limit = body_size_limit,
upstream_cert = options.upstream_cert,
- reverse_proxy = rp
+ reverse_proxy = rp,
+ transparent_proxy = trans
)