Browse Source

New `ssh_port` option was added to confings, it need to executing direct commands on remote router

pull/40/head
Paul Rock 6 years ago
parent
commit
951b781163
  1. 1
      configs/routeros-api.php
  2. 29
      src/Config.php

1
configs/routeros-api.php

@ -6,6 +6,7 @@ return [
// 'pass' => null, // 'pass' => null,
// 'port' => null, // 'port' => null,
'ssl' => false, 'ssl' => false,
'ssh_port' => 22,
'legacy' => false, 'legacy' => false,
'timeout' => 10, 'timeout' => 10,
'attempts' => 10, 'attempts' => 10,

29
src/Config.php

@ -17,6 +17,32 @@ use function gettype;
class Config implements ConfigInterface 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) * Array of parameters (with some default values)
* *
* @var array * @var array
@ -26,7 +52,8 @@ class Config implements ConfigInterface
'ssl' => Client::SSL, 'ssl' => Client::SSL,
'timeout' => Client::TIMEOUT, 'timeout' => Client::TIMEOUT,
'attempts' => Client::ATTEMPTS, 'attempts' => Client::ATTEMPTS,
'delay' => Client::ATTEMPTS_DELAY
'delay' => Client::ATTEMPTS_DELAY,
'ssh_port' => Client::SSH_PORT,
]; ];
/** /**

Loading…
Cancel
Save