119 lines
3.2 KiB
PHP
119 lines
3.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* This file is part of the "php-ipfs" package.
|
|
*
|
|
* (c) Robert Schönthal <robert.schoenthal@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace IPFS\Api;
|
|
|
|
use IPFS\Annotation\Api as Endpoint;
|
|
use IPFS\Command\Command;
|
|
|
|
/**
|
|
* @author Robert Schönthal <robert.schoenthal@gmail.com>
|
|
* @autogenerated
|
|
* @codeCoverageIgnore
|
|
*/
|
|
final class Dht implements Api
|
|
{
|
|
/**
|
|
* Query the DHT for all of the multiaddresses associated with a Peer ID.
|
|
*
|
|
* @Endpoint(name="dht:findpeer")
|
|
*
|
|
* @param string $arg the ID of the peer to search for
|
|
* @param bool $verbose print extra information
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function findpeer(string $arg, bool $verbose = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Find peers in the DHT that can provide a specific value, given a key.
|
|
*
|
|
* @Endpoint(name="dht:findprovs")
|
|
*
|
|
* @param string $arg the key to find providers for
|
|
* @param bool $verbose print extra information
|
|
* @param int $numProviders the number of providers to find
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function findprovs(string $arg, bool $verbose = false, int $numProviders = 20): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Given a key, query the DHT for its best value.
|
|
*
|
|
* @Endpoint(name="dht:get")
|
|
*
|
|
* @param string $arg the key to find a value for
|
|
* @param bool $verbose print extra information
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function get(string $arg, bool $verbose = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Announce to the network that you are providing given values.
|
|
*
|
|
* @Endpoint(name="dht:provide")
|
|
*
|
|
* @param string $arg the key[s] to send provide records for
|
|
* @param bool $verbose print extra information
|
|
* @param bool $recursive recursively provide entire graph
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function provide(string $arg, bool $verbose = false, bool $recursive = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Write a key/value pair to the DHT.
|
|
*
|
|
* @Endpoint(name="dht:put")
|
|
*
|
|
* @param string $arg the key to store the value at
|
|
* @param string $arg1 the value to store
|
|
* @param bool $verbose print extra information
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function put(string $arg, string $arg1, bool $verbose = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
|
|
/**
|
|
* Find the closest Peer IDs to a given Peer ID by querying the DHT.
|
|
*
|
|
* @Endpoint(name="dht:query")
|
|
*
|
|
* @param string $arg the peerID to run the query against
|
|
* @param bool $verbose print extra information
|
|
*
|
|
* @return Command
|
|
*/
|
|
public function query(string $arg, bool $verbose = false): Command
|
|
{
|
|
return new Command(__METHOD__, get_defined_vars());
|
|
}
|
|
}
|