2024-04-21 12:10:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Debug;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
use App\Models\Address;
|
|
|
|
|
|
|
|
class AddressCheck extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'debug:address:check'
|
|
|
|
.' {ftn : FTN}';
|
|
|
|
|
|
|
|
protected $description = 'Check the addresses we use for a node';
|
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$o = Address::findFTN($this->argument('ftn'));
|
|
|
|
|
|
|
|
if (! $o) {
|
|
|
|
$this->error(sprintf('Address: %s doesnt exist?',$this->argument('ftn')));
|
|
|
|
return Command::FAILURE;
|
|
|
|
}
|
|
|
|
|
2024-05-09 11:22:30 +00:00
|
|
|
$this->info(sprintf('Address: %s (%s)',$o->ftn,$o->role_name));
|
|
|
|
$this->info(sprintf("Children: \n- %s",$o->children()->pluck('ftn4d')->join("\n- ")));
|
|
|
|
$this->info(sprintf('Uplink: %s (Parent: %s)',$o->uplink()?->ftn,$o->parent()?->ftn));
|
2024-04-21 12:10:12 +00:00
|
|
|
$this->info(sprintf('Our Address: %s',our_address($o)?->ftn));
|
2024-05-09 11:22:30 +00:00
|
|
|
$this->info(sprintf('- Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(',')));
|
2024-04-21 12:10:12 +00:00
|
|
|
|
|
|
|
return Command::SUCCESS;
|
|
|
|
}
|
|
|
|
}
|