Support IPv6 brackets notation in utils/websockify
Parse square brackets-enclosed IPv6 in util/websockify for 'source_addr' and 'target_addr' parameters.
This commit is contained in:
parent
d58f8b5144
commit
a4c76bd1c6
|
|
@ -260,6 +260,7 @@ def websockify_init():
|
||||||
# Parse host:port and convert ports to numbers
|
# Parse host:port and convert ports to numbers
|
||||||
if args[0].count(':') > 0:
|
if args[0].count(':') > 0:
|
||||||
opts.listen_host, opts.listen_port = args[0].rsplit(':', 1)
|
opts.listen_host, opts.listen_port = args[0].rsplit(':', 1)
|
||||||
|
opts.listen_host = opts.listen_host.strip('[]')
|
||||||
else:
|
else:
|
||||||
opts.listen_host, opts.listen_port = '', args[0]
|
opts.listen_host, opts.listen_port = '', args[0]
|
||||||
|
|
||||||
|
|
@ -272,6 +273,7 @@ def websockify_init():
|
||||||
else:
|
else:
|
||||||
if args[1].count(':') > 0:
|
if args[1].count(':') > 0:
|
||||||
opts.target_host, opts.target_port = args[1].rsplit(':', 1)
|
opts.target_host, opts.target_port = args[1].rsplit(':', 1)
|
||||||
|
opts.target_host = opts.target_host.strip('[]')
|
||||||
else:
|
else:
|
||||||
parser.error("Error parsing target")
|
parser.error("Error parsing target")
|
||||||
try: opts.target_port = int(opts.target_port)
|
try: opts.target_port = int(opts.target_port)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue