Transparent proxy command-line flag stub.

This commit is contained in:
Aldo Cortesi 2012-06-26 20:08:24 +12:00
parent 8ccfb376f3
commit ad893ad134
2 changed files with 20 additions and 1 deletions

View File

@ -174,6 +174,11 @@ def common_options(parser):
action="store", dest="stickycookie_filt", default=None, metavar="FILTER",
help="Set sticky cookie filter. Matched against requests."
)
parser.add_option(
"-T",
action="store_true", dest="transparent_proxy", default=False,
help="Set transparent proxy mode."
)
parser.add_option(
"-u",
action="store", dest="stickyauth_filt", default=None, metavar="FILTER",

View File

@ -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
)