Changed to using new Address Model, Implemented Setup, Some minor CSS changes
This commit is contained in:
@@ -5,10 +5,10 @@ namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\Binkd as BinkdClass;
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
|
||||
use App\Classes\Protocol\Binkd as BinkdClass;
|
||||
use App\Models\Setup;
|
||||
|
||||
class BinkpReceive extends Command
|
||||
{
|
||||
@@ -35,8 +35,8 @@ class BinkpReceive extends Command
|
||||
{
|
||||
Log::info('Listening for BINKP connections...');
|
||||
|
||||
$server = new SocketServer(24554,'0.0.0.0');
|
||||
$server->setConnectionHandler([new BinkdClass,'onConnect']);
|
||||
$server = new SocketServer(Setup::BINKP_PORT,Setup::BINKP_BIND);
|
||||
$server->setConnectionHandler([new BinkdClass(Setup::findOrFail(config('app.id'))),'onConnect']);
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
@@ -3,12 +3,12 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\Binkd as BinkdClass;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Models\Node;
|
||||
use App\Models\{Address,Setup};
|
||||
|
||||
class BinkpSend extends Command
|
||||
{
|
||||
@@ -36,11 +36,19 @@ class BinkpSend extends Command
|
||||
{
|
||||
Log::info('Call BINKP send');
|
||||
|
||||
$no = Node::findFTN($this->argument('ftn'));
|
||||
$no = Address::findFTN($this->argument('ftn'));
|
||||
if (! $no)
|
||||
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
|
||||
|
||||
$client = SocketClient::create($no->address,$no->port);
|
||||
if ($no->system->mailer_type != Setup::O_BINKP)
|
||||
throw new \Exception(sprintf('Node [%s] doesnt support BINKD',$this->argument('ftn')));
|
||||
|
||||
$o = new BinkdClass;
|
||||
if ((! $no->system->mailer_address) || (! $no->system->mailer_port))
|
||||
throw new \Exception(sprintf('Unable to poll [%s] missing mailer details',$this->argument('ftn')));
|
||||
|
||||
$client = SocketClient::create($no->system->mailer_address,$no->system->mailer_port);
|
||||
|
||||
$o = new BinkdClass(Setup::findOrFail(config('app.id')));
|
||||
$o->session(BinkdClass::SESSION_BINKP,$client,$no);
|
||||
|
||||
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
|
||||
|
@@ -5,10 +5,10 @@ namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
use App\Models\Setup;
|
||||
|
||||
class EMSIReceive extends Command
|
||||
{
|
||||
@@ -35,8 +35,8 @@ class EMSIReceive extends Command
|
||||
{
|
||||
Log::info('Listening for EMSI connections...');
|
||||
|
||||
$server = new SocketServer(60179,'0.0.0.0');
|
||||
$server->setConnectionHandler([new EMSIClass,'onConnect']);
|
||||
$server = new SocketServer(Setup::EMSI_PORT,Setup::EMSI_BIND);
|
||||
$server->setConnectionHandler([new EMSIClass(Setup::findOrFail(config('app.id'))),'onConnect']);
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Node;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Sock\SocketClient;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Models\{Address,Setup};
|
||||
|
||||
class EMSISend extends Command
|
||||
{
|
||||
@@ -36,11 +36,19 @@ class EMSISend extends Command
|
||||
{
|
||||
Log::info('Call EMSI send');
|
||||
|
||||
$no = Node::findFTN($this->argument('ftn'));
|
||||
$no = Address::findFTN($this->argument('ftn'));
|
||||
if (! $no)
|
||||
throw new ModelNotFoundException('Unknown node: '.$this->argument('ftn'));
|
||||
|
||||
$client = SocketClient::create($no->address,$no->port,38400);
|
||||
if ($no->system->mailer_type != Setup::O_EMSI)
|
||||
throw new \Exception(sprintf('Node [%s] doesnt support EMSI',$this->argument('ftn')));
|
||||
|
||||
$o = new EMSIClass;
|
||||
if ((! $no->system->mailer_address) || (! $no->system->mailer_port))
|
||||
throw new \Exception(sprintf('Unable to poll [%s] missing mailer details',$this->argument('ftn')));
|
||||
|
||||
$client = SocketClient::create($no->system->mailer_address,$no->system->mailer_port,38400);
|
||||
|
||||
$o = new EMSIClass(Setup::findOrFail(config('app.id')));
|
||||
$o->session(EMSIClass::SESSION_AUTO,$client,$no);
|
||||
|
||||
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
|
||||
|
@@ -2,15 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Protocol\Binkd;
|
||||
use App\Classes\Protocol\EMSI;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\{Binkd,EMSI};
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
use App\Models\Setup;
|
||||
|
||||
class StartServer extends Command
|
||||
{
|
||||
@@ -35,18 +33,20 @@ class StartServer extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$o = Setup::findOrFail(config('app.id'));
|
||||
|
||||
// @todo This should be a config item.
|
||||
$start = [
|
||||
'emsi' => [
|
||||
'address'=>'0.0.0.0',
|
||||
'port'=>60179,
|
||||
'class'=>new EMSI,
|
||||
'address'=>Setup::EMSI_BIND,
|
||||
'port'=>Setup::EMSI_PORT,
|
||||
'class'=>new EMSI($o),
|
||||
|
||||
],
|
||||
'binkp' => [
|
||||
'address'=>'0.0.0.0',
|
||||
'port'=>24554,
|
||||
'class'=>new Binkd,
|
||||
'address'=>Setup::BINKP_BIND,
|
||||
'port'=>Setup::BINKP_PORT,
|
||||
'class'=>new Binkd($o),
|
||||
],
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user