mirror of https://github.com/PurpleI2P/regi2p.git
Domain registry project
http://reg.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
925 B
40 lines
925 B
4 years ago
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use App\BOB;
|
||
|
use Amp\Parallel\Worker\Environment;
|
||
|
use Amp\Parallel\Worker\Task;
|
||
|
use Amp\Parallel\Worker\TaskFailureError;
|
||
|
use Amp\Parallel\Worker\TaskFailureException;
|
||
|
use Amp\Parallel\Worker\TaskFailureThrowable;
|
||
|
|
||
|
class Checker implements Task
|
||
|
{
|
||
|
private $options = [];
|
||
|
private $base32;
|
||
|
|
||
|
public function __construct($base32, $options = [])
|
||
|
{
|
||
|
$this->options = array_merge($this->options, (array) $options);
|
||
|
$this->base32 = $base32;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param Environment $environment
|
||
|
* @return \Amp\Promise|\Generator|mixed
|
||
|
*/
|
||
|
public function run(Environment $environment)
|
||
|
{
|
||
|
$bob = new BOB($this->options);
|
||
|
|
||
|
$bob->getnick();
|
||
|
$result = $bob->lookup($this->base32 . ".b32.i2p");
|
||
|
|
||
|
$bob = null;
|
||
|
echo "Processed " . $this->base32 . ": " . ($result ? "online" : "offline") . PHP_EOL;
|
||
|
return $result;
|
||
|
}
|
||
|
}
|
||
|
|