Permalink
Browse files

changed dht address to option, made tool.sh executable

git-svn-id: svn://forre.st/undns@1194 470744a7-cac9-478e-843e-5ec1b25c69e8
  • Loading branch information...
1 parent b8f6478 commit 8ff0551e7a915b958fef38d8508bfabfb831a7df forrest committed Mar 15, 2011
Showing with 15 additions and 11 deletions.
  1. +7 −5 server.py
  2. +6 −6 test.sh
  3. +2 −0 tool.py
View
@@ -21,7 +21,7 @@
except IOError:
__version__ = "unknown"
-name = "UnDNS (version %s)" % (__version__,)
+name = "UnDNS server (version %s)" % (__version__,)
parser = optparse.OptionParser(version=__version__, description=name)
parser.add_option("-a", "--authoritative-dns", metavar="PORT",
@@ -36,10 +36,12 @@
parser.add_option("-d", "--dht-port", metavar="PORT",
help="use UDP port PORT to connect to other DHT nodes and listen for connections (if not specified a random high port is chosen)",
type="int", action="store", default=random.randrange(49152, 65536), dest="dht_port")
-#parser.add_option("-n", "--node", metavar="ADDR:PORT",
-# help="connect to existing DHT node at ADDR listening on UDP port PORT",
-# type="int", action="append", default=random.randrange(49152, 65536), dest="dht_port")
+parser.add_option("-n", "--node", metavar="ADDR:PORT",
+ help="connect to existing DHT node at ADDR listening on UDP port PORT",
+ type="string", action="append", default=[], dest="dht_nodes")
(options, args) = parser.parse_args()
+if args:
+ parser.error("takes no arguments")
print name
@@ -49,7 +51,7 @@
def parse(x):
ip, port = x.split(':')
return ip, int(port)
-knownNodes = map(parse, args)
+knownNodes = map(parse, options.dht_nodes)
packets = [packet.Packet.from_binary(open(filename).read()) for filename in options.packet_filenames]
View
12 test.sh
@@ -1,21 +1,21 @@
#!/bin/bash
-time python tool.py generate > $1.key
+./tool.py generate > $1.key
echo key:
-time python tool.py view $1.key
+./tool.py view $1.key
echo
echo url:
-time python tool.py info $1.key
+./tool.py info $1.key
echo
-time python tool.py encode $1.key $1.zone > $1.packet
+./tool.py encode $1.key $1.zone > $1.packet
echo packet:
-time python tool.py view $1.packet
+./tool.py view $1.packet
echo
echo decode:
-time python tool.py decode $1.packet
+./tool.py decode $1.packet
View
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
import sys
import hashlib

0 comments on commit 8ff0551

Please sign in to comment.