Merge 'dev' with dht, ecc auth, proof of work and fixes.
[brdnet.git] / TestDHT.pas
blob09234a1ed19ac40ae37cc9194287f0cd0a7ee5a1
1 unit TestDHT;
3 INTERFACE
4 IMPLEMENTATION
5 USES ServerLoop,NetAddr,SysUtils,DHT,dhtWebBoot;
6 type t=object
7 procedure init;
8 end;
9 procedure t.init;
10 var oi:word;
11 const opt='-test-dht';
12 const opt2='-test-boot';
13 var addr:tNetAddr;
14 begin
15 oi:=OptIndex(opt);
16 if oi>0 then begin
17 assert(OptParamCount(oi)=1,opt+'(rcpt:tNetAddr)');
18 addr:=paramstr(oi+1);
19 writeln('TestDHT: rcpt '+paramstr(oi+1));
20 DHT.NodeBootstrap(addr);
21 end;
22 oi:=OptIndex(opt2);
23 if oi>0 then begin
24 assert(OptParamCount(oi)=1,opt2+'(url)');
25 Bootstrap(paramstr(oi+1));
26 end;
27 end;
29 var o:t;
30 BEGIN
31 Shedule(10,@o.init);
32 END.