mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Transparent proxy command-line flag stub.
This commit is contained in:
parent
8ccfb376f3
commit
ad893ad134
@ -174,6 +174,11 @@ def common_options(parser):
|
|||||||
action="store", dest="stickycookie_filt", default=None, metavar="FILTER",
|
action="store", dest="stickycookie_filt", default=None, metavar="FILTER",
|
||||||
help="Set sticky cookie filter. Matched against requests."
|
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(
|
parser.add_option(
|
||||||
"-u",
|
"-u",
|
||||||
action="store", dest="stickyauth_filt", default=None, metavar="FILTER",
|
action="store", dest="stickyauth_filt", default=None, metavar="FILTER",
|
||||||
|
@ -379,6 +379,8 @@ def certificate_option_group(parser):
|
|||||||
parser.add_option_group(group)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
|
|
||||||
|
TRANSPARENT_SSL_PORTS = [443, 8443]
|
||||||
|
|
||||||
def process_proxy_options(parser, options):
|
def process_proxy_options(parser, options):
|
||||||
if options.cert:
|
if options.cert:
|
||||||
options.cert = os.path.expanduser(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)
|
options.cache = os.path.expanduser(options.cache)
|
||||||
body_size_limit = utils.parse_size(options.body_size_limit)
|
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:
|
if options.reverse_proxy:
|
||||||
rp = utils.parse_proxy_spec(options.reverse_proxy)
|
rp = utils.parse_proxy_spec(options.reverse_proxy)
|
||||||
if not rp:
|
if not rp:
|
||||||
@ -412,5 +425,6 @@ def process_proxy_options(parser, options):
|
|||||||
cert_wait_time = options.cert_wait_time,
|
cert_wait_time = options.cert_wait_time,
|
||||||
body_size_limit = body_size_limit,
|
body_size_limit = body_size_limit,
|
||||||
upstream_cert = options.upstream_cert,
|
upstream_cert = options.upstream_cert,
|
||||||
reverse_proxy = rp
|
reverse_proxy = rp,
|
||||||
|
transparent_proxy = trans
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user