Commit 2f9a92a4 authored by anonym's avatar anonym

tor-controlport-filter: add --listen-address option.

parent 3bc126c9
......@@ -60,6 +60,7 @@ import stem.control
import sys
import yaml
DEFAULT_LISTEN_ADDRESS = 'localhost'
DEFAULT_LISTEN_PORT = 9051
DEFAULT_COOKIE_PATH = '/var/run/tor/control.authcookie'
DEFAULT_CONTROL_SOCKET_PATH = '/var/run/tor/control'
......@@ -308,6 +309,11 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler):
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"-a", "--listen-address",
type=str, metavar='ADDR', default=DEFAULT_LISTEN_ADDRESS,
help="specifies the address on which the server listens " +
"(default: {})".format(DEFAULT_LISTEN_ADDRESS))
parser.add_argument(
"-p", "--listen-port",
type=int, metavar='PORT', default=DEFAULT_LISTEN_PORT,
......@@ -331,11 +337,11 @@ def main():
global global_args
global_args = parser.parse_args()
server = socketserver.ThreadingTCPServer(
("localhost", global_args.listen_port),
(global_args.listen_address, global_args.listen_port),
FilteredControlPortProxyHandler
)
log("Tor control port filter started, listening on {}"
.format(global_args.listen_port))
log("Tor control port filter started, listening on {}:{}"
.format(global_args.listen_address, global_args.listen_port))
try:
server.serve_forever()
except KeyboardInterrupt:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment