diff --git a/configs/routeros-api.php b/configs/routeros-api.php index 91a3359..e049aff 100644 --- a/configs/routeros-api.php +++ b/configs/routeros-api.php @@ -6,6 +6,7 @@ return [ // 'pass' => null, // 'port' => null, 'ssl' => false, + 'ssh_port' => 22, 'legacy' => false, 'timeout' => 10, 'attempts' => 10, diff --git a/src/Config.php b/src/Config.php index fbabf75..f26828f 100644 --- a/src/Config.php +++ b/src/Config.php @@ -17,6 +17,32 @@ use function gettype; class Config implements ConfigInterface { /** + * List of allowed parameters of config + */ + public const ALLOWED = [ + // Address of Mikrotik RouterOS + 'host' => 'string', + // Username + 'user' => 'string', + // Password + 'pass' => 'string', + // RouterOS API port number for access (if not set use default or default with SSL if SSL enabled) + 'port' => 'integer', + // Enable ssl support (if port is not set this parameter must change default port to ssl port) + 'ssl' => 'boolean', + // Support of legacy login scheme (true - pre 6.43, false - post 6.43) + 'legacy' => 'boolean', + // Max timeout for answer from RouterOS + 'timeout' => 'integer', + // Count of attempts to establish TCP session + 'attempts' => 'integer', + // Delay between attempts in seconds + 'delay' => 'integer', + // Number of SSH port + 'ssh_port' => 'integer', + ]; + + /** * Array of parameters (with some default values) * * @var array @@ -26,7 +52,8 @@ class Config implements ConfigInterface 'ssl' => Client::SSL, 'timeout' => Client::TIMEOUT, 'attempts' => Client::ATTEMPTS, - 'delay' => Client::ATTEMPTS_DELAY + 'delay' => Client::ATTEMPTS_DELAY, + 'ssh_port' => Client::SSH_PORT, ]; /**