diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/proxy/gnunet-gns-proxy.py | 27 | ||||
-rw-r--r-- | src/gns/test_gns_defaults.conf | 75 |
2 files changed, 97 insertions, 5 deletions
diff --git a/src/gns/proxy/gnunet-gns-proxy.py b/src/gns/proxy/gnunet-gns-proxy.py index 094f5412c..f13a0adad 100644 --- a/src/gns/proxy/gnunet-gns-proxy.py +++ b/src/gns/proxy/gnunet-gns-proxy.py | |||
@@ -47,15 +47,21 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): | |||
47 | print 'calling gnunet-gns -a '+netloc[:i] | 47 | print 'calling gnunet-gns -a '+netloc[:i] |
48 | auth = os.popen("gnunet-gns -a "+netloc[:i]) | 48 | auth = os.popen("gnunet-gns -a "+netloc[:i]) |
49 | lines = auth.readlines() | 49 | lines = auth.readlines() |
50 | print 'result: '+lines[0].split(" ")[-1].rstrip() | 50 | if (len(lines) > 0): |
51 | to_replace = lines[0].split(" ")[-1].rstrip() | 51 | print 'result: '+lines[0].split(" ")[-1].rstrip() |
52 | to_replace = lines[0].split(" ")[-1].rstrip() | ||
53 | else: | ||
54 | to_replace = "+" | ||
52 | self.host_port = netloc[:i], int(netloc[i+1:]) | 55 | self.host_port = netloc[:i], int(netloc[i+1:]) |
53 | else: | 56 | else: |
54 | print 'calling gnunet-gns -a '+netloc | 57 | print 'calling gnunet-gns -a '+netloc |
55 | auth = os.popen("gnunet-gns -a "+netloc) | 58 | auth = os.popen("gnunet-gns -a "+netloc) |
56 | lines = auth.readlines() | 59 | lines = auth.readlines() |
57 | print 'result: '+lines[0].split(" ")[-1].rstrip() | 60 | if (len(lines) > 0): |
58 | to_replace = lines[0].split(" ")[-1].rstrip() | 61 | print 'result: '+lines[0].split(" ")[-1].rstrip() |
62 | to_replace = lines[0].split(" ")[-1].rstrip() | ||
63 | else: | ||
64 | to_replace = "+" | ||
59 | self.host_port = netloc, 80 | 65 | self.host_port = netloc, 80 |
60 | print "\t" "connect to %s:%d" % self.host_port | 66 | print "\t" "connect to %s:%d" % self.host_port |
61 | try: soc.connect(self.host_port) | 67 | try: soc.connect(self.host_port) |
@@ -84,9 +90,20 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): | |||
84 | 90 | ||
85 | def shorten_zkey(self): | 91 | def shorten_zkey(self): |
86 | return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s"+string.replace(mo.group(1), 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() | 92 | return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s"+string.replace(mo.group(1), 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() |
93 | |||
94 | def test_re(self, to_repl, mo): | ||
95 | short = os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a href="http://', "")) | ||
96 | lines = short.readlines() | ||
97 | if (len(lines) < 1): | ||
98 | return to_repl | ||
99 | elif (len(lines.split(" ")) > 0): | ||
100 | return 'a href="http://'+lines.split(" ")[-1].rstrip() | ||
101 | else: | ||
102 | return to_repl | ||
87 | 103 | ||
88 | def replace_and_shorten(self, to_repl): | 104 | def replace_and_shorten(self, to_repl): |
89 | return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() | 105 | return lambda mo: test_re(self, to_repl, mo) |
106 | # return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a href="http://', "")).readlines()[0].split(" ")[-1].rstrip() | ||
90 | #full = string.replace(mo.group(1)+to_repl, 'a href="http://', "") | 107 | #full = string.replace(mo.group(1)+to_repl, 'a href="http://', "") |
91 | #print 'calling gnunet-gns -s '+full | 108 | #print 'calling gnunet-gns -s '+full |
92 | #s = os.popen("gnunet-gns -s "+full) | 109 | #s = os.popen("gnunet-gns -s "+full) |
diff --git a/src/gns/test_gns_defaults.conf b/src/gns/test_gns_defaults.conf new file mode 100644 index 000000000..762c9641b --- /dev/null +++ b/src/gns/test_gns_defaults.conf | |||
@@ -0,0 +1,75 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/test-gnunet-testing/ | ||
3 | DEFAULTCONFIG = test_testing_defaults.conf | ||
4 | |||
5 | [resolver] | ||
6 | PORT = 2564 | ||
7 | |||
8 | [transport] | ||
9 | PORT = 2565 | ||
10 | PLUGINS = tcp | ||
11 | |||
12 | [arm] | ||
13 | PORT = 2566 | ||
14 | DEFAULTSERVICES = | ||
15 | |||
16 | [statistics] | ||
17 | PORT = 2567 | ||
18 | |||
19 | [transport-tcp] | ||
20 | PORT = 2568 | ||
21 | BINDTO = 127.0.0.1 | ||
22 | |||
23 | [peerinfo] | ||
24 | PORT = 2569 | ||
25 | |||
26 | [core] | ||
27 | PORT = 2570 | ||
28 | |||
29 | [testing] | ||
30 | NUM_PEERS = 5 | ||
31 | WEAKRANDOM = YES | ||
32 | F2F = YES | ||
33 | HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat | ||
34 | |||
35 | [dht] | ||
36 | AUTOSTART = NO | ||
37 | |||
38 | [nat] | ||
39 | DISABLEV6 = YES | ||
40 | ENABLE_UPNP = NO | ||
41 | BEHIND_NAT = NO | ||
42 | ALLOW_NAT = NO | ||
43 | INTERNAL_ADDRESS = 127.0.0.1 | ||
44 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
45 | USE_LOCALADDR = NO | ||
46 | |||
47 | [dns] | ||
48 | AUTOSTART = NO | ||
49 | |||
50 | [nse] | ||
51 | AUTOSTART = NO | ||
52 | |||
53 | [mesh] | ||
54 | AUTOSTART = NO | ||
55 | |||
56 | [datastore] | ||
57 | AUTOSTART = NO | ||
58 | |||
59 | [fs] | ||
60 | AUTOSTART = NO | ||
61 | |||
62 | [dv] | ||
63 | AUTOSTART = NO | ||
64 | |||
65 | [chat] | ||
66 | AUTOSTART = NO | ||
67 | |||
68 | [vpn] | ||
69 | AUTOSTART = NO | ||
70 | |||
71 | [gns] | ||
72 | AUTOSTART = NO | ||
73 | |||
74 | [namestore] | ||
75 | AUTOSTART = NO \ No newline at end of file | ||