aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gns/proxy/gnunet-gns-proxy.py27
-rw-r--r--src/gns/test_gns_defaults.conf75
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]
2SERVICEHOME = /tmp/test-gnunet-testing/
3DEFAULTCONFIG = test_testing_defaults.conf
4
5[resolver]
6PORT = 2564
7
8[transport]
9PORT = 2565
10PLUGINS = tcp
11
12[arm]
13PORT = 2566
14DEFAULTSERVICES =
15
16[statistics]
17PORT = 2567
18
19[transport-tcp]
20PORT = 2568
21BINDTO = 127.0.0.1
22
23[peerinfo]
24PORT = 2569
25
26[core]
27PORT = 2570
28
29[testing]
30NUM_PEERS = 5
31WEAKRANDOM = YES
32F2F = YES
33HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
34
35[dht]
36AUTOSTART = NO
37
38[nat]
39DISABLEV6 = YES
40ENABLE_UPNP = NO
41BEHIND_NAT = NO
42ALLOW_NAT = NO
43INTERNAL_ADDRESS = 127.0.0.1
44EXTERNAL_ADDRESS = 127.0.0.1
45USE_LOCALADDR = NO
46
47[dns]
48AUTOSTART = NO
49
50[nse]
51AUTOSTART = NO
52
53[mesh]
54AUTOSTART = NO
55
56[datastore]
57AUTOSTART = NO
58
59[fs]
60AUTOSTART = NO
61
62[dv]
63AUTOSTART = NO
64
65[chat]
66AUTOSTART = NO
67
68[vpn]
69AUTOSTART = NO
70
71[gns]
72AUTOSTART = NO
73
74[namestore]
75AUTOSTART = NO \ No newline at end of file