Add the ability to log users and their shared subdomains

This commit is contained in:
Marcel Pociot
2021-11-10 16:43:23 +01:00
parent 97993318e7
commit b9b07c9664
10 changed files with 231 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ use App\Contracts\StatisticsCollector;
use App\Contracts\SubdomainGenerator;
use App\Http\QueryParameters;
use App\Server\Exceptions\NoFreePortAvailable;
use App\Contracts\LoggerRepository;
use Ratchet\ConnectionInterface;
use React\EventLoop\LoopInterface;
use React\Socket\Server;
@@ -28,11 +29,15 @@ class ConnectionManager implements ConnectionManagerContract
/** @var StatisticsCollector */
protected $statisticsCollector;
public function __construct(SubdomainGenerator $subdomainGenerator, StatisticsCollector $statisticsCollector, LoopInterface $loop)
/** @var LoggerRepository */
protected $logger;
public function __construct(SubdomainGenerator $subdomainGenerator, StatisticsCollector $statisticsCollector, LoggerRepository $logger, LoopInterface $loop)
{
$this->subdomainGenerator = $subdomainGenerator;
$this->loop = $loop;
$this->statisticsCollector = $statisticsCollector;
$this->logger = $logger;
}
public function limitConnectionLength(ControlConnection $connection, int $maximumConnectionLength)
@@ -67,6 +72,8 @@ class ConnectionManager implements ConnectionManagerContract
$this->statisticsCollector->siteShared($this->getAuthTokenFromConnection($connection));
$this->logger->logSubdomain($storedConnection->authToken, $storedConnection->subdomain);
return $storedConnection;
}