Some BINKP optimisation, implemented crypt, implemented receiving compressed transfers

This commit is contained in:
2023-07-02 23:40:08 +10:00
parent f9f9fb5345
commit 6f298d778f
28 changed files with 1614 additions and 904 deletions

View File

@@ -7,19 +7,17 @@ use App\Models\{Address,File};
class Tic extends Item
{
private string $file;
/**
* @throws \Exception
*/
public function __construct(Address $ao,File $fo,int $action)
{
$this->action |= $action;
$tic = new FTNTic;
switch ($action) {
case self::I_SEND:
$tic = new FTNTic;
$this->file = $tic->generate($ao,$fo);
$this->file_type = self::IS_TIC;
$this->file_name = sprintf('%s.tic',sprintf('%08x',$fo->id));
$this->file_size = strlen($this->file);
$this->file_mtime = $fo->created_at->timestamp;
@@ -29,6 +27,9 @@ class Tic extends Item
default:
throw new \Exception('Unknown action: '.$action);
}
$this->action = $action;
$this->type = self::IS_TIC;
}
public function read(int $start,int $length): string