More complete rework of packet parsing and packet generation with 29710c

This commit is contained in:
2024-05-19 23:28:45 +10:00
parent 46f52dd56d
commit f279d85b08
43 changed files with 412 additions and 291 deletions

View File

@@ -10,6 +10,33 @@ use App\Classes\FTN\Packet;
use App\Jobs\PacketProcess as Job;
use App\Models\Address;
/**
* Things to test
* + Packet
* - Sender doesnt exist (try and send a bounce message in the same session)
* - Sender defined in DB by not ours
* - Sender has wrong password
* - Packet too old
*
* + Echomail
* - Area doesnt exist (to uplink)
* - Sender not subscribed (to uplink)
* - Sender cannot post (to uplink)
* - Sender has wrong address for echorea domain (to uplink)
* - Test message in echoarea
* - Echomail from address doesnt match packet envelope (to uplink)
* - Echomail too old (to uplink)
* - Rescanned dont generate notifications
* - Rescanned dont trigger bots
* - Some Notifications to an uplink should go to the admin instead?
*
* + Netmail
* - To hub, and user not defined (reject)
* - To hub, but user redirect (redirected)
* - To areafix (processed)
* - To ping (respond)
* - With trace turned on (respond)
*/
class PacketProcess extends Command
{
/**
@@ -38,25 +65,25 @@ class PacketProcess extends Command
*/
public function handle()
{
$fs = Storage::disk(config('fido.local_disk'));
//$fs = Storage::disk(config('fido.local_disk'));
$rel_name = sprintf('%s/%s',config('fido.dir'),$this->argument('file'));
$f = new File($fs->path($rel_name));
//$f = new File($fs->path($rel_name));
$m = [];
if ($this->argument('ftn')) {
$a = Address::findFTN($this->argument('ftn'));
$ao = Address::findFTN($this->argument('ftn'));
} elseif (preg_match(sprintf('/^%s\.(.{3})$/',Packet::regex),$this->argument('file'),$m)) {
$a = Address::findOrFail(hexdec($m[1]));
$ao = Address::findOrFail(hexdec($m[1]));
} else {
$this->error('Unable to determine sender FTN address');
exit(1);
}
$x = Job::dispatchSync($rel_name,$a->zone->domain,$this->option('dontqueue'));
Job::dispatchSync($rel_name,$ao->zone->domain,$this->option('dontqueue'));
dd(['job completed'=>$x]);
return Command::SUCCESS;
}
}