Commit | Line | Data |
---|---|---|
3fba9787 IJ |
1 | #!/usr/bin/python2 |
2 | ||
3 | from twisted.web.server import Site | |
4 | from twisted.web.resource import Resource | |
5 | from twisted.web.server import NOT_DONE_YET | |
6 | from twisted.internet import reactor | |
7 | ||
8 | import ConfigParser | |
9 | ||
10 | import cgi | |
11 | ||
12 | clients = { } | |
13 | ||
14 | def ipaddress(input): | |
15 | try: | |
16 | r = IPv4Address(input) | |
17 | except AddressValueError: | |
18 | r = IPv6Address(input) | |
19 | return r | |
20 | ||
21 | def ipnetwork(input): | |
22 | try: | |
23 | r = IPv4Network(input) | |
24 | except NetworkValueError: | |
25 | r = IPv6Network(input) | |
26 | return r | |
27 | ||
28 | def process_cfg(): | |
29 | global network | |
30 | global ourself | |
31 | ||
32 | network = ipnetwork(cfg.get('virtual','network') | |
33 | try: | |
34 | ourself = cfg.get('virtual','server') | |
35 | except ConfigParser.NoOptionError: | |
36 | ourself = network.hosts().next() | |
37 | ||
38 | ||
39 | ||
40 | class Client(): | |
41 | def __init__(ip): | |
42 | # instance data members | |
43 | # ._ip | |
44 | self._ip = IPv4Address(ip) | |
45 | clients | |
46 | ||
47 | class FormPage(Resource): | |
48 | def render_POST(self, request): |