diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-01-26 10:06:46 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-01-26 10:06:46 +0000 |
commit | 57d6cf3c8765c511a80e8b873500d213cc884ac7 (patch) | |
tree | b02d175434ed6760acef188e3431fab477fa19fd /src/nat | |
parent | 8384033b4d63e8dff136dc67e9b207401a49246d (diff) | |
download | gnunet-57d6cf3c8765c511a80e8b873500d213cc884ac7.tar.gz gnunet-57d6cf3c8765c511a80e8b873500d213cc884ac7.zip |
initial changes to get the nat test to run
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/test-nat.conf | 350 | ||||
-rw-r--r-- | src/nat/test_nat.c | 23 |
2 files changed, 371 insertions, 2 deletions
diff --git a/src/nat/test-nat.conf b/src/nat/test-nat.conf new file mode 100644 index 000000000..9c74535ef --- /dev/null +++ b/src/nat/test-nat.conf | |||
@@ -0,0 +1,350 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/nat-test | ||
3 | # SERVICEHOME = /var/lib/gnunet/ | ||
4 | # DEFAULTCONFIG = /etc/gnunet.conf | ||
5 | # If 'DEFAULTCONFIG' is not defined, the current | ||
6 | # configuration file is assumed to be the default, | ||
7 | # which is what we want by default... | ||
8 | |||
9 | [gnunetd] | ||
10 | HOSTKEY = $SERVICEHOME/.hostkey | ||
11 | |||
12 | [TESTING] | ||
13 | WEAKRANDOM = NO | ||
14 | |||
15 | [client] | ||
16 | HOME = $SERVICEHOME | ||
17 | |||
18 | [transport-tcp] | ||
19 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | ||
20 | PORT = 2086 | ||
21 | ADVERTISED_PORT = 2086 | ||
22 | |||
23 | # Are we behind NAT? | ||
24 | BEHIND_NAT = YES | ||
25 | |||
26 | # Is the NAT hole-punched? | ||
27 | PUNCHED_NAT = NO | ||
28 | |||
29 | # Disable UPNP by default until it gets cleaner! | ||
30 | ENABLE_UPNP = NO | ||
31 | |||
32 | # External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!) | ||
33 | # normal interface IP address for non-NATed peers; | ||
34 | # possibly auto-detected (using UPnP) if possible if not specified | ||
35 | # EXTERNAL_ADDRESS = | ||
36 | |||
37 | # Should we use ICMP-based NAT traversal to try connect to NATed peers | ||
38 | # or, if we are behind NAT, to allow connections to us? | ||
39 | ENABLE_ICMP_CLIENT = YES | ||
40 | ENABLE_ICMP_SERVER = YES | ||
41 | |||
42 | # IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; | ||
43 | # normal interface IP address for non-NATed peers; | ||
44 | # likely auto-detected (via interface list) if not specified (!) | ||
45 | # INTERNAL_ADDRESS = | ||
46 | |||
47 | # Only bind to a specific IP address; if both are given, this should be idential to INTERNAL_ADDRESS | ||
48 | # (but use different: this one restricts our bind!) | ||
49 | # BINDTO = | ||
50 | |||
51 | TIMEOUT = 300000 | ||
52 | |||
53 | # Disable IPv6 support | ||
54 | # DISABLEV6 = | ||
55 | # ACCEPT_FROM = | ||
56 | # ACCEPT_FROM6 = | ||
57 | # REJECT_FROM = | ||
58 | # REJECT_FROM6 = | ||
59 | |||
60 | [transport-udp] | ||
61 | PORT = 2086 | ||
62 | # BEHIND_NAT = | ||
63 | # BINDTO = | ||
64 | # ALLOW_NAT = | ||
65 | # ONLY_NAT_ADDRESSES = | ||
66 | # INTERNAL_ADDRESS = | ||
67 | # EXTERNAL_ADDRESS = | ||
68 | |||
69 | [transport-http] | ||
70 | PORT = 1080 | ||
71 | |||
72 | [transport-https] | ||
73 | PORT = 4433 | ||
74 | |||
75 | [arm] | ||
76 | PORT = 2087 | ||
77 | HOSTNAME = localhost | ||
78 | HOME = $SERVICEHOME | ||
79 | CONFIG = $DEFAULTCONFIG | ||
80 | BINARY = gnunet-service-arm | ||
81 | ACCEPT_FROM = 127.0.0.1; | ||
82 | ACCEPT_FROM6 = ::1; | ||
83 | DEFAULTSERVICES = topology hostlist | ||
84 | UNIXPATH = /tmp/gnunet-service-arm.sock | ||
85 | UNIX_MATCH_UID = YES | ||
86 | UNIX_MATCH_GID = YES | ||
87 | # GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs | ||
88 | # GLOBAL_PREFIX = | ||
89 | # USERNAME = | ||
90 | # MAXBUF = | ||
91 | # TIMEOUT = | ||
92 | # DISABLEV6 = | ||
93 | # BINDTO = | ||
94 | # REJECT_FROM = | ||
95 | # REJECT_FROM6 = | ||
96 | # PREFIX = | ||
97 | |||
98 | [statistics] | ||
99 | AUTOSTART = YES | ||
100 | PORT = 2088 | ||
101 | HOSTNAME = localhost | ||
102 | HOME = $SERVICEHOME | ||
103 | CONFIG = $DEFAULTCONFIG | ||
104 | BINARY = gnunet-service-statistics | ||
105 | ACCEPT_FROM = 127.0.0.1; | ||
106 | ACCEPT_FROM6 = ::1; | ||
107 | UNIXPATH = /tmp/gnunet-service-statistics.sock | ||
108 | UNIX_MATCH_UID = NO | ||
109 | UNIX_MATCH_GID = YES | ||
110 | # DISABLE_SOCKET_FORWARDING = NO | ||
111 | # USERNAME = | ||
112 | # MAXBUF = | ||
113 | # TIMEOUT = | ||
114 | # DISABLEV6 = | ||
115 | # BINDTO = | ||
116 | # REJECT_FROM = | ||
117 | # REJECT_FROM6 = | ||
118 | # PREFIX = | ||
119 | |||
120 | [resolver] | ||
121 | AUTOSTART = YES | ||
122 | PORT = 2089 | ||
123 | HOSTNAME = localhost | ||
124 | HOME = $SERVICEHOME | ||
125 | CONFIG = $DEFAULTCONFIG | ||
126 | BINARY = gnunet-service-resolver | ||
127 | ACCEPT_FROM = 127.0.0.1; | ||
128 | ACCEPT_FROM6 = ::1; | ||
129 | UNIXPATH = /tmp/gnunet-service-resolver.sock | ||
130 | UNIX_MATCH_UID = NO | ||
131 | UNIX_MATCH_GID = NO | ||
132 | # DISABLE_SOCKET_FORWARDING = NO | ||
133 | # USERNAME = | ||
134 | # MAXBUF = | ||
135 | # TIMEOUT = | ||
136 | # DISABLEV6 = | ||
137 | # BINDTO = | ||
138 | # REJECT_FROM = | ||
139 | # REJECT_FROM6 = | ||
140 | # PREFIX = | ||
141 | |||
142 | [peerinfo] | ||
143 | AUTOSTART = YES | ||
144 | PORT = 2090 | ||
145 | HOSTNAME = localhost | ||
146 | HOME = $SERVICEHOME | ||
147 | CONFIG = $DEFAULTCONFIG | ||
148 | BINARY = gnunet-service-peerinfo | ||
149 | ACCEPT_FROM = 127.0.0.1; | ||
150 | ACCEPT_FROM6 = ::1; | ||
151 | UNIXPATH = /tmp/gnunet-service-peerinfo.sock | ||
152 | UNIX_MATCH_UID = NO | ||
153 | UNIX_MATCH_GID = YES | ||
154 | # DISABLE_SOCKET_FORWARDING = NO | ||
155 | # USERNAME = | ||
156 | # MAXBUF = | ||
157 | # TIMEOUT = | ||
158 | # DISABLEV6 = | ||
159 | # BINDTO = | ||
160 | # REJECT_FROM = | ||
161 | # REJECT_FROM6 = | ||
162 | # PREFIX = | ||
163 | HOSTS = $SERVICEHOME/data/hosts/ | ||
164 | |||
165 | |||
166 | [transport] | ||
167 | AUTOSTART = YES | ||
168 | PORT = 2091 | ||
169 | HOSTNAME = localhost | ||
170 | HOME = $SERVICEHOME | ||
171 | CONFIG = $DEFAULTCONFIG | ||
172 | BINARY = gnunet-service-transport | ||
173 | NEIGHBOUR_LIMIT = 50 | ||
174 | ACCEPT_FROM = 127.0.0.1; | ||
175 | ACCEPT_FROM6 = ::1; | ||
176 | PLUGINS = tcp | ||
177 | UNIXPATH = /tmp/gnunet-service-transport.sock | ||
178 | BLACKLIST_FILE = $SERVICEHOME/blacklist | ||
179 | UNIX_MATCH_UID = YES | ||
180 | UNIX_MATCH_GID = YES | ||
181 | # DISABLE_SOCKET_FORWARDING = NO | ||
182 | # USERNAME = | ||
183 | # MAXBUF = | ||
184 | # TIMEOUT = | ||
185 | # DISABLEV6 = | ||
186 | # BINDTO = | ||
187 | # REJECT_FROM = | ||
188 | # REJECT_FROM6 = | ||
189 | # PREFIX = | ||
190 | |||
191 | [core] | ||
192 | AUTOSTART = YES | ||
193 | PORT = 2092 | ||
194 | HOSTNAME = localhost | ||
195 | HOME = $SERVICEHOME | ||
196 | CONFIG = $DEFAULTCONFIG | ||
197 | BINARY = gnunet-service-core | ||
198 | ACCEPT_FROM = 127.0.0.1; | ||
199 | ACCEPT_FROM6 = ::1; | ||
200 | # quotas are in bytes per second now! | ||
201 | TOTAL_QUOTA_IN = 65536 | ||
202 | TOTAL_QUOTA_OUT = 65536 | ||
203 | UNIXPATH = /tmp/gnunet-service-core.sock | ||
204 | UNIX_MATCH_UID = YES | ||
205 | UNIX_MATCH_GID = YES | ||
206 | # DISABLE_SOCKET_FORWARDING = NO | ||
207 | # DEBUG = YES | ||
208 | # USERNAME = | ||
209 | # MAXBUF = | ||
210 | # TIMEOUT = | ||
211 | # DISABLEV6 = | ||
212 | # BINDTO = | ||
213 | # REJECT_FROM = | ||
214 | # REJECT_FROM6 = | ||
215 | # PREFIX = | ||
216 | |||
217 | |||
218 | [topology] | ||
219 | MINIMUM-FRIENDS = 0 | ||
220 | FRIENDS-ONLY = NO | ||
221 | AUTOCONNECT = YES | ||
222 | TARGET-CONNECTION-COUNT = 16 | ||
223 | FRIENDS = $SERVICEHOME/friends | ||
224 | CONFIG = $DEFAULTCONFIG | ||
225 | BINARY = gnunet-daemon-topology | ||
226 | |||
227 | [hostlist] | ||
228 | # port for hostlist http server | ||
229 | HTTPPORT = 8080 | ||
230 | HOME = $SERVICEHOME | ||
231 | HOSTLISTFILE = $SERVICEHOME/hostlist/learned.data | ||
232 | CONFIG = $DEFAULTCONFIG | ||
233 | BINARY = gnunet-daemon-hostlist | ||
234 | # consider having "-e" as default as well once implemented | ||
235 | OPTIONS = -b | ||
236 | SERVERS = http://v9.gnunet.org:58080/ | ||
237 | # proxy for downloading hostlists | ||
238 | HTTP-PROXY = | ||
239 | |||
240 | |||
241 | [datastore] | ||
242 | AUTOSTART = YES | ||
243 | UNIXPATH = /tmp/gnunet-service-datastore.sock | ||
244 | UNIX_MATCH_UID = YES | ||
245 | UNIX_MATCH_GID = YES | ||
246 | PORT = 2093 | ||
247 | HOSTNAME = localhost | ||
248 | HOME = $SERVICEHOME | ||
249 | CONFIG = $DEFAULTCONFIG | ||
250 | BINARY = gnunet-service-datastore | ||
251 | ACCEPT_FROM = 127.0.0.1; | ||
252 | ACCEPT_FROM6 = ::1; | ||
253 | QUOTA = 100000000 | ||
254 | BLOOMFILTER = $SERVICEHOME/fs/bloomfilter | ||
255 | DATABASE = sqlite | ||
256 | # DISABLE_SOCKET_FORWARDING = NO | ||
257 | |||
258 | [datastore-sqlite] | ||
259 | FILENAME = $SERVICEHOME/datastore/sqlite.db | ||
260 | |||
261 | [datastore-postgres] | ||
262 | CONFIG = connect_timeout=10; dbname=gnunet | ||
263 | |||
264 | [datastore-mysql] | ||
265 | DATABASE = gnunet | ||
266 | CONFIG = ~/.my.cnf | ||
267 | # USER = gnunet | ||
268 | # PASSWORD = | ||
269 | # HOST = localhost | ||
270 | # PORT = 3306 | ||
271 | |||
272 | [datacache-mysql] | ||
273 | DATABASE = gnunetcheck | ||
274 | CONFIG = ~/.my.cnf | ||
275 | # USER = gnunet | ||
276 | # PASSWORD = | ||
277 | # HOST = localhost | ||
278 | # PORT = 3306 | ||
279 | |||
280 | |||
281 | [fs] | ||
282 | AUTOSTART = YES | ||
283 | INDEXDB = $SERVICEHOME/idxinfo.lst | ||
284 | TRUST = $SERVICEHOME/data/credit/ | ||
285 | IDENTITY_DIR = $SERVICEHOME/identities/ | ||
286 | STATE_DIR = $SERVICEHOME/persistence/ | ||
287 | UPDATE_DIR = $SERVICEHOME/updates/ | ||
288 | PORT = 2094 | ||
289 | HOSTNAME = localhost | ||
290 | HOME = $SERVICEHOME | ||
291 | CONFIG = $DEFAULTCONFIG | ||
292 | BINARY = gnunet-service-fs | ||
293 | ACCEPT_FROM = 127.0.0.1; | ||
294 | ACCEPT_FROM6 = ::1; | ||
295 | |||
296 | CONTENT_CACHING = YES | ||
297 | CONTENT_PUSHING = YES | ||
298 | |||
299 | UNIXPATH = /tmp/gnunet-service-fs.sock | ||
300 | UNIX_MATCH_UID = NO | ||
301 | UNIX_MATCH_GID = YES | ||
302 | # DISABLE_SOCKET_FORWARDING = NO | ||
303 | # DEBUG = YES | ||
304 | MAX_PENDING_REQUESTS = 65536 | ||
305 | # Maximum frequency we're allowed to poll the datastore | ||
306 | # for content for migration (can be used to reduce | ||
307 | # GNUnet's disk-IO rate) | ||
308 | MIN_MIGRATION_DELAY = 1000 | ||
309 | EXPECTED_NEIGHBOUR_COUNT = 128 | ||
310 | |||
311 | [dht] | ||
312 | AUTOSTART = YES | ||
313 | PORT = 2095 | ||
314 | HOSTNAME = localhost | ||
315 | HOME = $SERVICEHOME | ||
316 | CONFIG = $DEFAULTCONFIG | ||
317 | BINARY = gnunet-service-dht | ||
318 | ACCEPT_FROM = 127.0.0.1; | ||
319 | ACCEPT_FROM6 = ::1; | ||
320 | BUCKET_SIZE = 4 | ||
321 | UNIXPATH = /tmp/gnunet-service-dht.sock | ||
322 | UNIX_MATCH_UID = YES | ||
323 | UNIX_MATCH_GID = YES | ||
324 | # DISABLE_SOCKET_FORWARDING = NO | ||
325 | # DEBUG = YES | ||
326 | # USERNAME = | ||
327 | # MAXBUF = | ||
328 | # TIMEOUT = | ||
329 | # DISABLEV6 = | ||
330 | # BINDTO = | ||
331 | # REJECT_FROM = | ||
332 | # REJECT_FROM6 = | ||
333 | # PREFIX = | ||
334 | # DO_FIND_PEER = | ||
335 | # STRICT_KADEMLIA = | ||
336 | # USE_MAX_HOPS = | ||
337 | # MAX_HOPS = | ||
338 | # REPUBLISH = YES | ||
339 | # REPLICATION_FREQUENCY = 60 | ||
340 | # STOP_ON_CLOSEST = | ||
341 | # STOP_FOUND = | ||
342 | # CONVERGE_MODIFIER = | ||
343 | |||
344 | |||
345 | [dhtcache] | ||
346 | DATABASE = sqlite | ||
347 | QUOTA = 1024000 | ||
348 | |||
349 | [block] | ||
350 | PLUGINS = fs dht test | ||
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c index c71623c2e..9fab3a9ba 100644 --- a/src/nat/test_nat.c +++ b/src/nat/test_nat.c | |||
@@ -136,12 +136,31 @@ main (int argc, char *const argv[]) | |||
136 | GNUNET_GETOPT_OPTION_END | 136 | GNUNET_GETOPT_OPTION_END |
137 | }; | 137 | }; |
138 | 138 | ||
139 | GNUNET_log_setup ("test-nat", "DEBUG", NULL); | 139 | char *const argv_prog[] = { |
140 | "test-nat", | ||
141 | "-c", | ||
142 | "test-nat.conf", | ||
143 | "-L", | ||
144 | #if VERBOSE | ||
145 | "DEBUG", | ||
146 | #else | ||
147 | "WARNING", | ||
148 | #endif | ||
149 | NULL | ||
150 | }; | ||
151 | |||
152 | GNUNET_log_setup ("test-nat", | ||
153 | #if VERBOSE | ||
154 | "DEBUG", | ||
155 | #else | ||
156 | "WARNING", | ||
157 | #endif | ||
158 | NULL); | ||
140 | 159 | ||
141 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 160 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
142 | "Testing NAT library, timeout set to %d seconds\n", TIMEOUT); | 161 | "Testing NAT library, timeout set to %d seconds\n", TIMEOUT); |
143 | 162 | ||
144 | GNUNET_PROGRAM_run (argc, argv, "test-nat", "nohelp", options, &run, NULL); | 163 | GNUNET_PROGRAM_run (5, argv_prog, "test-nat", "nohelp", options, &run, NULL); |
145 | 164 | ||
146 | return 0; | 165 | return 0; |
147 | } | 166 | } |