Transfering netmail via EMSI
This commit is contained in:
@@ -10,16 +10,18 @@ use Illuminate\Support\Str;
|
||||
* Class SocketClient
|
||||
*
|
||||
* @package App\Classes\Sock
|
||||
* @property int speed
|
||||
* @property int cps
|
||||
* @property int speed
|
||||
*/
|
||||
final class SocketClient {
|
||||
// For deep debugging
|
||||
private bool $DEBUG = FALSE;
|
||||
|
||||
private \Socket $connection;
|
||||
private string $address = '';
|
||||
private int $port = 0;
|
||||
private string $address_local = '';
|
||||
private int $port_local = 0;
|
||||
private string $address_remote = '';
|
||||
private int $port_remote = 0;
|
||||
|
||||
// Our session state
|
||||
private array $session = [];
|
||||
@@ -52,14 +54,19 @@ final class SocketClient {
|
||||
private string $rx_buf = '';
|
||||
|
||||
public function __construct (\Socket $connection,int $speed=self::TCP_SPEED) {
|
||||
socket_getsockname($connection,$this->address,$this->port);
|
||||
Log::info(sprintf('%s: + Connection from [%s] on port [%d]',__METHOD__,$this->address,$this->port));
|
||||
socket_getsockname($connection,$this->address_local,$this->port_local);
|
||||
socket_getpeername($connection,$this->address_remote,$this->port_remote);
|
||||
Log::info(sprintf('%s: + Connection from [%s] on port [%d]',__METHOD__,$this->address_remote,$this->port_remote));
|
||||
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
switch ($key) {
|
||||
case 'address_remote':
|
||||
case 'port_remote':
|
||||
return $this->{$key};
|
||||
|
||||
case 'cps':
|
||||
case 'speed':
|
||||
return Arr::get($this->session,$key);
|
||||
@@ -244,6 +251,7 @@ final class SocketClient {
|
||||
*
|
||||
* @return string
|
||||
* @todo change to __get()
|
||||
* @deprecated
|
||||
*/
|
||||
public function getAddress(): string
|
||||
{
|
||||
@@ -255,6 +263,7 @@ final class SocketClient {
|
||||
*
|
||||
* @return int
|
||||
* @todo change to __get()
|
||||
* @deprecated
|
||||
*/
|
||||
public function getPort(): int
|
||||
{
|
||||
|
Reference in New Issue
Block a user