Auto create Domains/Zones as systems present their AKAs to us

This commit is contained in:
Deon George
2022-12-01 23:51:43 +11:00
parent 55a2a67b8d
commit d5d4a0d781
6 changed files with 112 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
use App\Classes\File\{Receive,Send};
use App\Classes\Sock\SocketClient;
use App\Classes\Sock\SocketException;
use App\Models\{Address,Setup};
use App\Models\{Address,Setup,System};
abstract class Protocol
{
@@ -313,6 +313,19 @@ abstract class Protocol
(($rc & self::S_MASK) == self::S_OK) ? 'Successful' : 'Failed',
));
// Add unknown FTNs to the DB
if ($this->node->aka_remote_authed->count()) {
$so = $this->node->aka_remote_authed->first()->system;
} else {
$so = System::where('name','Discovered System')->single();
}
if ($so && $so->exists) {
foreach ($this->node->aka_other as $aka) {
Address::findFTN($aka,TRUE,$so);
}
}
// @todo Log to history log in the DB.
//if ($this->node->start_time && $this->setup->cfg('CFG_HISTORY')) {}