remcodex / router
Remote code execution router
dev-master
2021-02-17 22:34 UTC
Requires
- php: ^7.4 || ^8.0
- ext-json: *
- ahmard/reactphp-timers: ^1.0
- nette/utils: ^3.2
- react/http: ^1.2
Requires (Dev)
- phpstan/phpstan: ^0.12.65
This package is auto-updated.
Last update: 2025-03-18 08:18:42 UTC
README
Remote code execution router/load balancer - Checks which RCE Server has the lowest connections and sends the client request to it.
Notice 🔊
This project is currently receiving massive updates, which may include code refactoring, namespace change, and many
other stuffs that may cause the code to brake or not work entirely.
This project is not ready!!!
Installation
composer require remcodex/router
Usage
use Remcodex\Router\RemoteServer; use Remcodex\Router\Server; require 'vendor/autoload.php'; $serverUri = '0.0.0.0:9000'; $server = Server::listen($serverUri); //Add remote server $server->addRemoteServer( //1 RemoteServer::create('localhost:9110') ->protocol(RemoteServer::UNSECURE) ->path('api/http/request'), //2 RemoteServer::create('localhost:9111') ->protocol(RemoteServer::UNSECURE) ->path('api/http/request'), //3 RemoteServer::create('localhost:9112') ->protocol(RemoteServer::UNSECURE) ->path('api/http/request'), ); //Add error handler $server->onError(function (Throwable $exception) { echo "Error occurred"; echo $exception; }); echo "Server starting at: http://{$serverUri}\n"; $server->start();
Note: Remote Servers must be started for each address registered above.
Built with ReactPHP