|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the "php-ipfs" package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Robert Schönthal <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace IPFS\Api; |
|
15
|
|
|
|
|
16
|
|
|
use IPFS\Annotation\Api as Endpoint; |
|
17
|
|
|
use IPFS\Command\Command; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @author Robert Schönthal <[email protected]> |
|
21
|
|
|
* @autogenerated |
|
22
|
|
|
* @codeCoverageIgnore |
|
23
|
|
|
*/ |
|
24
|
|
|
final class Swarm implements Api |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* List interface listening addresses. |
|
28
|
|
|
* |
|
29
|
|
|
* @Endpoint(name="swarm:addrs:listen") |
|
30
|
|
|
* |
|
31
|
|
|
* @return Command |
|
32
|
|
|
*/ |
|
33
|
|
|
public function addrsListen(): Command |
|
34
|
|
|
{ |
|
35
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* List local addresses. |
|
40
|
|
|
* |
|
41
|
|
|
* @Endpoint(name="swarm:addrs:local") |
|
42
|
|
|
* |
|
43
|
|
|
* @param bool $id show peer ID in addresses |
|
44
|
|
|
* |
|
45
|
|
|
* @return Command |
|
46
|
|
|
*/ |
|
47
|
|
|
public function addrsLocal(bool $id = false): Command |
|
48
|
|
|
{ |
|
49
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Open connection to a given address. |
|
54
|
|
|
* |
|
55
|
|
|
* @Endpoint(name="swarm:connect") |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $arg address of peer to connect to |
|
58
|
|
|
* |
|
59
|
|
|
* @return Command |
|
60
|
|
|
*/ |
|
61
|
|
|
public function connect(string $arg): Command |
|
62
|
|
|
{ |
|
63
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Close connection to a given address. |
|
68
|
|
|
* |
|
69
|
|
|
* @Endpoint(name="swarm:disconnect") |
|
70
|
|
|
* |
|
71
|
|
|
* @param string $arg address of peer to disconnect from |
|
72
|
|
|
* |
|
73
|
|
|
* @return Command |
|
74
|
|
|
*/ |
|
75
|
|
|
public function disconnect(string $arg): Command |
|
76
|
|
|
{ |
|
77
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Add an address filter. |
|
82
|
|
|
* |
|
83
|
|
|
* @Endpoint(name="swarm:filters:add") |
|
84
|
|
|
* |
|
85
|
|
|
* @param string $arg multiaddr to filter |
|
86
|
|
|
* |
|
87
|
|
|
* @return Command |
|
88
|
|
|
*/ |
|
89
|
|
|
public function filtersAdd(string $arg): Command |
|
90
|
|
|
{ |
|
91
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Remove an address filter. |
|
96
|
|
|
* |
|
97
|
|
|
* @Endpoint(name="swarm:filters:rm") |
|
98
|
|
|
* |
|
99
|
|
|
* @param string $arg multiaddr filter to remove |
|
100
|
|
|
* |
|
101
|
|
|
* @return Command |
|
102
|
|
|
*/ |
|
103
|
|
|
public function filtersRm(string $arg): Command |
|
104
|
|
|
{ |
|
105
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* List peers with open connections. |
|
110
|
|
|
* |
|
111
|
|
|
* @Endpoint(name="swarm:peers") |
|
112
|
|
|
* |
|
113
|
|
|
* @param bool $verbose display all extra information |
|
114
|
|
|
* @param bool $streams also list information about open streams for each peer |
|
115
|
|
|
* @param bool $latency also list information about latency to each peer |
|
116
|
|
|
* |
|
117
|
|
|
* @return Command |
|
118
|
|
|
*/ |
|
119
|
|
|
public function peers(bool $verbose = false, bool $streams = false, bool $latency = false): Command |
|
120
|
|
|
{ |
|
121
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|