aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/gnunet-peerinfo.115
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c24
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py16
3 files changed, 53 insertions, 2 deletions
diff --git a/doc/man/gnunet-peerinfo.1 b/doc/man/gnunet-peerinfo.1
index 3eb2157d6..99a560075 100644
--- a/doc/man/gnunet-peerinfo.1
+++ b/doc/man/gnunet-peerinfo.1
@@ -10,7 +10,7 @@ gnunet\-peerinfo \- Display information about other peers.
10 10
11.SH DESCRIPTION 11.SH DESCRIPTION
12.PP 12.PP
13\fBgnunet\-peerinfo\fP display the known addresses and trust of known peers. 13\fBgnunet\-peerinfo\fP display the known addresses and trust of known peers. The tool can also be used to change the amount of trust we have in another peer. For this, the options should be first the amount of trust changed (prefix it with "\-\- " if the amount is negative) followed by the peer identity.
14 14
15.SH OPTIONS 15.SH OPTIONS
16.B 16.B
@@ -35,8 +35,19 @@ Print the version number
35.IP "\-L LOGLEVEL, \-\-loglelvel=LOGLEVEL" 35.IP "\-L LOGLEVEL, \-\-loglelvel=LOGLEVEL"
36Set the loglevel 36Set the loglevel
37 37
38.SH EXAMPLE
39.TP
40gnunet\-peerinfo 4 S9LBDF6V770H8CELVKBFJMOTS25LB272JB81MRJHSRJI9B1FBVOSGJVSEIRIS5J4SRDU4HT3TBPLM4MNEND7FFUHMGCK4NBR8R2UTSG
41Increase the trust in a peer by 4
42.TP
43gnunet\-peerinfo \-\- \-2 S9LBDF6V770H8CELVKBFJMOTS25LB272JB81MRJHSRJI9B1FBVOSGJVSEIRIS5J4SRDU4HT3TBPLM4MNEND7FFUHMGCK4NBR8R2UTSG
44Decrease the trust in a peer by 2
45
46
47
48
38.SH BUGS 49.SH BUGS
39Report bugs by using mantis <https://gnunet.org/mantis/> or by sending electronic mail to <gnunet\-developers@gnu.org> 50Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
40 51
41.SH SEE ALSO 52.SH SEE ALSO
42gnunet.conf(5) 53gnunet.conf(5)
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index ba6609596..ba9832099 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -228,9 +228,33 @@ run (void *cls,
228 struct GNUNET_PeerIdentity pid; 228 struct GNUNET_PeerIdentity pid;
229 struct GNUNET_CRYPTO_HashAsciiEncoded enc; 229 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
230 char *fn; 230 char *fn;
231 int delta;
231 232
232 sched = s; 233 sched = s;
233 cfg = c; 234 cfg = c;
235 delta = 0;
236 if ( (args[0] != NULL) &&
237 (args[1] != NULL) &&
238 (1 == sscanf(args[0], "%d", &delta)) &&
239 (GNUNET_OK ==
240 GNUNET_CRYPTO_hash_from_string (args[1],
241 &pid.hashPubKey)) )
242 {
243 peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
244 GNUNET_PEERINFO_iterate (peerinfo,
245 &pid,
246 delta,
247 GNUNET_TIME_UNIT_SECONDS,
248 &print_peer_info, NULL);
249 return;
250 }
251 else if (args[0] != NULL)
252 {
253 fprintf (stderr,
254 _("Invalid command line argument `%s'\n"),
255 args[0]);
256 return;
257 }
234 if (get_self != GNUNET_YES) 258 if (get_self != GNUNET_YES)
235 { 259 {
236 peerinfo = GNUNET_PEERINFO_connect (sched, cfg); 260 peerinfo = GNUNET_PEERINFO_connect (sched, cfg);
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py b/src/peerinfo-tool/test_gnunet_peerinfo.py
index 3aa8497af..e9881a7b6 100755
--- a/src/peerinfo-tool/test_gnunet_peerinfo.py
+++ b/src/peerinfo-tool/test_gnunet_peerinfo.py
@@ -38,6 +38,11 @@ try:
38 pinfo.expect (re.compile (".......................................................................................................\r")); 38 pinfo.expect (re.compile (".......................................................................................................\r"));
39 pinfo.expect (pexpect.EOF); 39 pinfo.expect (pexpect.EOF);
40 40
41 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf invalid')
42 pinfo.expect (re.compile ("Invalid command line argument `invalid\'\r"));
43 pinfo.expect (pexpect.EOF);
44
45
41 os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf') 46 os.system ('gnunet-arm -q -i transport -c test_gnunet_peerinfo_data.conf')
42 47
43 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf') 48 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf')
@@ -50,6 +55,17 @@ try:
50 pinfo.expect (re.compile (" *127.0.0.1:24357\r")); 55 pinfo.expect (re.compile (" *127.0.0.1:24357\r"));
51 pinfo.expect (pexpect.EOF); 56 pinfo.expect (pexpect.EOF);
52 57
58 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -qs')
59 pid = pinfo.read (-1)
60 pid = pid.strip ()
61
62 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf 4 ' + pid)
63 pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *4\r"));
64 pinfo.expect (pexpect.EOF);
65
66 pinfo = pexpect.spawn ('gnunet-peerinfo -c test_gnunet_peerinfo_data.conf -- -4 ' + pid)
67 pinfo.expect (re.compile ("Peer `" + pid + "\' with trust *0\r"));
68 pinfo.expect (pexpect.EOF);
53 69
54finally: 70finally:
55 os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq') 71 os.system ('gnunet-arm -c test_gnunet_peerinfo_data.conf -eq')