1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare (strict_types=1); |
4
|
|
|
namespace IPFS\Api; |
5
|
|
|
|
6
|
|
|
use IPFS\Annotation\Api as Endpoint; |
7
|
|
|
use IPFS\Command\Command; |
8
|
|
|
/** |
9
|
|
|
* @author Robert Schönthal <[email protected]> |
10
|
|
|
* @autogenerated |
11
|
|
|
* @codeCoverageIgnore |
12
|
|
|
*/ |
13
|
|
|
final class Dht implements Api |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Query the DHT for all of the multiaddresses associated with a Peer ID. |
17
|
|
|
* |
18
|
|
|
* @Endpoint(name="dht:findpeer") |
19
|
|
|
* |
20
|
|
|
* @param string $arg The ID of the peer to search for. |
21
|
|
|
* @param bool $verbose Print extra information. |
22
|
|
|
* |
23
|
|
|
* @return Command |
24
|
|
|
*/ |
25
|
|
|
public function findpeer(string $arg, bool $verbose = false) : Command |
26
|
|
|
{ |
27
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
28
|
|
|
} |
29
|
|
|
/** |
30
|
|
|
* Find peers in the DHT that can provide a specific value, given a key. |
31
|
|
|
* |
32
|
|
|
* @Endpoint(name="dht:findprovs") |
33
|
|
|
* |
34
|
|
|
* @param string $arg The key to find providers for. |
35
|
|
|
* @param bool $verbose Print extra information. |
36
|
|
|
* |
37
|
|
|
* @return Command |
38
|
|
|
*/ |
39
|
|
|
public function findprovs(string $arg, bool $verbose = false) : Command |
40
|
|
|
{ |
41
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
42
|
|
|
} |
43
|
|
|
/** |
44
|
|
|
* Given a key, query the DHT for its best value. |
45
|
|
|
* |
46
|
|
|
* @Endpoint(name="dht:get") |
47
|
|
|
* |
48
|
|
|
* @param string $arg The key to find a value for. |
49
|
|
|
* @param bool $verbose Print extra information. |
50
|
|
|
* |
51
|
|
|
* @return Command |
52
|
|
|
*/ |
53
|
|
|
public function get(string $arg, bool $verbose = false) : Command |
54
|
|
|
{ |
55
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
56
|
|
|
} |
57
|
|
|
/** |
58
|
|
|
* Announce to the network that you are providing given values. |
59
|
|
|
* |
60
|
|
|
* @Endpoint(name="dht:provide") |
61
|
|
|
* |
62
|
|
|
* @param string]: The key[s $arg The key[s] to send provide records for. |
63
|
|
|
* @param bool $verbose Print extra information. |
64
|
|
|
* @param bool $recursive Recursively provide entire graph. |
65
|
|
|
* |
66
|
|
|
* @return Command |
67
|
|
|
*/ |
68
|
|
|
public function provide(string]: The key[s $arg, bool $verbose = false, bool $recursive = false) : Command |
|
|
|
|
69
|
|
|
{ |
70
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
71
|
|
|
} |
72
|
|
|
/** |
73
|
|
|
* Write a key/value pair to the DHT. |
74
|
|
|
* |
75
|
|
|
* @Endpoint(name="dht:put") |
76
|
|
|
* |
77
|
|
|
* @param string $arg The key to store the value at. |
78
|
|
|
* @param string $arg1 The value to store. |
79
|
|
|
* @param bool $verbose Print extra information. |
80
|
|
|
* |
81
|
|
|
* @return Command |
82
|
|
|
*/ |
83
|
|
|
public function put(string $arg, string $arg1, bool $verbose = false) : Command |
84
|
|
|
{ |
85
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
86
|
|
|
} |
87
|
|
|
/** |
88
|
|
|
* Find the closest Peer IDs to a given Peer ID by querying the DHT. |
89
|
|
|
* |
90
|
|
|
* @Endpoint(name="dht:query") |
91
|
|
|
* |
92
|
|
|
* @param string $arg The peerID to run the query against. |
93
|
|
|
* @param bool $verbose Print extra information. |
94
|
|
|
* |
95
|
|
|
* @return Command |
96
|
|
|
*/ |
97
|
|
|
public function query(string $arg, bool $verbose = false) : Command |
98
|
|
|
{ |
99
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
100
|
|
|
} |
101
|
|
|
} |