[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] remove ignore_pubkey param, treat http as special case
commit 701a03c82900c4c76963563554234c86929d30d1
Author: Ximin Luo <infinity0@xxxxxxxxxxxxxx>
Date: Sun Jul 6 21:53:11 2014 +0100
remove ignore_pubkey param, treat http as special case
---
flashproxy-reg-http | 12 +++++++++---
flashproxy/reg.py | 11 +++++------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/flashproxy-reg-http b/flashproxy-reg-http
index debd2d1..3414802 100755
--- a/flashproxy-reg-http
+++ b/flashproxy-reg-http
@@ -6,8 +6,8 @@ import flashproxy
import sys
import urllib2
-from flashproxy.util import safe_format_addr
-from flashproxy.reg import DEFAULT_FACILITATOR_URL, build_reg
+from flashproxy.util import format_addr, parse_addr_spec, safe_format_addr
+from flashproxy.reg import DEFAULT_FACILITATOR_URL, DEFAULT_REMOTE, DEFAULT_TRANSPORT, build_reg
parser = argparse.ArgumentParser(
usage="%(prog)s [OPTIONS] [REMOTE][:PORT]",
@@ -15,7 +15,13 @@ parser = argparse.ArgumentParser(
"If only the external port is given, the remote server guesses our "
"external address.")
flashproxy.util.add_module_opts(parser)
-flashproxy.reg.add_registration_args(parser, ignore_pubkey=True)
+parser.add_argument("--transport", metavar="TRANSPORT",
+ help="register using the given transport, default %(default)s.",
+ default=DEFAULT_TRANSPORT)
+parser.add_argument("remote_addr", metavar="ADDR:PORT",
+ help="external addr+port to register, default %s" %
+ format_addr(DEFAULT_REMOTE), default="", nargs="?",
+ type=lambda x: parse_addr_spec(x, *DEFAULT_REMOTE))
parser.add_argument("-f", "--facilitator", metavar="URL",
help="register with the given facilitator, default %(default)s.",
default=DEFAULT_FACILITATOR_URL)
diff --git a/flashproxy/reg.py b/flashproxy/reg.py
index bc292dc..84a1275 100644
--- a/flashproxy/reg.py
+++ b/flashproxy/reg.py
@@ -19,19 +19,18 @@ M5SDDYYY4xxEPzokjFJfCQv+kcyAnzERNMQ9kR41ePTXG62bpngK5iWGeJ5XdkxG
gwIDAQAB
-----END PUBLIC KEY-----
"""
-_OPTION_IGNORED = "ignored; for compatibility with other methods"
class options(object):
transport = DEFAULT_TRANSPORT
facilitator_pubkey = None
-def add_module_opts(parser, ignore_pubkey=False):
+def add_module_opts(parser):
parser.add_argument("--transport", metavar="TRANSPORT",
help="register using the given transport, default %(default)s.",
default=DEFAULT_TRANSPORT)
parser.add_argument("--facilitator-pubkey", metavar="FILENAME",
- help=(_OPTION_IGNORED if ignore_pubkey else "encrypt registrations to "
- "the given PEM-formatted public key file (default built-in)."))
+ help=("encrypt registrations to the given PEM-formatted public "
+ "key file (default built-in)."))
old_parse = parser.parse_args
def parse_args(namespace):
@@ -40,8 +39,8 @@ def add_module_opts(parser, ignore_pubkey=False):
return namespace
parser.parse_args = lambda *a, **kw: parse_args(old_parse(*a, **kw))
-def add_registration_args(parser, **kwargs):
- add_module_opts(parser, **kwargs)
+def add_registration_args(parser):
+ add_module_opts(parser)
parser.add_argument("remote_addr", metavar="ADDR:PORT",
help="external addr+port to register, default %s" %
format_addr(DEFAULT_REMOTE), default="", nargs="?",
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits