-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from xterm-inator/peer-names
Add peer name or comment of name to router depending on MikroTik version
- Loading branch information
Showing
6 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\RouterOS\Data; | ||
|
||
readonly class Resource | ||
{ | ||
public string $version; | ||
|
||
public function __construct(string $version) | ||
{ | ||
$this->version = explode(' ', $version)[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\RouterOS; | ||
|
||
use App\RouterOS\Data\Resource as ResourceData; | ||
|
||
class Resource extends RouterOS | ||
{ | ||
|
||
public static function getRouterResource(): ResourceData | ||
{ | ||
$routerOS = new self(); | ||
|
||
$response = $routerOS->client->query('/system/resource/print')->read(); | ||
if ($response) { | ||
return new ResourceData($response[0]['version']); | ||
} | ||
|
||
throw new \Exception('Could not find WireGuard interface'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters