--- /dev/null
+This is just a simple list of tasks that could be done for
+python-rwhoisd.
+
+
+* Get it working on Windows.
+
+ One of the (few) reasons folks might want to use this RWhois server
+ is that they want to run the server on Windows and think that this
+ one might be easier to get working that the C version.
+
+** Get it to run with the standard command line Window's python.
+
+** Make it a bit more friendly to run.
+
+* Create proper unit tests.
+
+ The code has some relatively decent unit tests embedded in the
+ modules, but these should be separated out and be converted to use
+ unittest.
+
+* Create a BSDDB index.
+
+ This server can't handle a lot of data. It loads everything into
+ memory and isn't particularly efficient about it. It is written in
+ python, after all.
+
+ Anyway, the basic way that the in-memory indexes maps fairly well to
+ a bsddb btree indexes. Differences (besides just actual
+ implementation) is that it is probably easier to just use strings
+ for ordering, which means that IPv6 CIDR indexes would have to be in
+ separate btrees from the v4 indexes.
+
# USA
import socket, types, copy, bisect, struct
+import v6addr
def new(address, netlen = -1):
"""Construct either a CidrV4 or CidrV6 object."""
class Cidr:
"""A class representing a generic CIDRized network value."""
-
-
def _initialize(self, address, netlen):
"""This a common constructor that is used by the subclasses."""
# This file is part of python-rwhoisd
#
-# Copyright (C) 2003, David E. Blacka
-#
-# $Id: RwhoisServer.py,v 1.3 2003/04/28 16:45:11 davidb Exp $
+# Copyright (C) 2003, 2008 David E. Blacka
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# a simplified regex that just makes sure that the IPv6 address string
# isn't obviously invalid.
-v6char_re = re.compile(r'[0-9a-f:]+(:\d+\.\d+\.\d+\.\d+)?', re.I)
+v6char_re = re.compile(r'^[0-9a-f:]+(:(\d{1,3}\.){3}\d{1,3})?$', re.I)
def v6str_to_addr(addrstr):
"""Convert IPv6 addresses into its packed numerical value."""
a = v6str_to_addr(addr)
b = v6addr_to_str(a)
except socket.error, e:
- print e
+ print "addr was invalid!:", e
else:
print "%s => %s" % (addr, b)
try_good_addr("1:2:3::7:8")
try_good_addr("2001:3c09:102::23:af")
try_good_addr("::ffff:1.2.3.4")
- try_good_addr("1:2:3:4:5:6:7:4.3.2.1")
+ try_good_addr("1:2:3:4:5:6:4.3.2.1")
def try_bad_addr(addr):
try:
except socket.error, e:
print e
else:
- print "addr was valid!", addr
+ print "addr was valid! %s => %s" % (addr, v6addr_to_str(a))
# things that shouldn't parse
try_bad_addr(":")
try_bad_addr("::3::")
try_bad_addr("::1.2.3")
try_bad_addr("12345::1")
+ try_bad_addr("1:2:3:4:5:6:7:4.3.2.1")