router_os_client 2.0.0
router_os_client: ^2.0.0 copied to clipboard
RouterOSClient is a Dart/Flutter package that provides an easy-to-use interface for connecting and interacting with Mikrotik's RouterOS devices via a socket connection.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0+1 #
Date: August 27, 2024
Added #
- Initial release of
router_os_client
. - Basic API connection functionality for RouterOS devices.
- Added documentation and examples for usage.
1.0.2 #
Date: August 31, 2024
Fix #
-
fix: prevent empty maps from being added to parsed replies
-
Modified the
_parseReply
method to ensure that only non-empty maps are added to theparsedReplies
list. This prevents the unnecessary{}
from being returned at the end of command execution.
1.0.3 #
Date: August 31, 2024
Changed #
- Replace print statements with Logger for consistent logging
- Updated all print statements to use the Logger instance.
- Ensured that verbose logging is handled through the logger for better control.
- Improved error handling and log messaging with appropriate log levels (debug, info, warning, error).
1.0.4 #
Date: September 2, 2024
Added #
- _parseCommand Method Update:
- Introduced a check to determine if a command part contains an = character.
- Preserved parts containing = without modification to avoid incorrect command formatting.
- Applied a / prefix only to base command parts that do not contain =.
Fixed #
- Command Parsing Issue:
- Resolved an issue where commands with parameters (e.g., profile=1d) were incorrectly parsed by adding an extra = character. This fix ensures that commands such as /ip/hotspot/user/print profile=1d are parsed correctly and sent as /ip/hotspot/user/print with profile=1d as a parameter.
- Corrected the behavior of the client.talk method to ensure proper communication with the RouterOS API, allowing for accurate filtering of data.
Improved #
- Command Handling:
- Enhanced the robustness of the command parsing mechanism, ensuring that commands with parameters are handled accurately and without unintended modifications.
1.0.5 #
Date: September 7, 2024
Fixed #
- Fixed issue where
talk
function would throw an "invalid arguments" error whenmessage
is a single string. - Ensured that single strings passed to
talk
are wrapped in aList<String>
before sending to_send
function.
Changed #
- Added explicit handling for
message
when it is a single string to convert it into a list. - Updated error handling to improve robustness for dynamic inputs.
1.0.6 #
Date: September 7, 2024
Added #
- Added example project to demonstrate usage of the
router_os_client
package.
1.0.7 #
Date: September 7, 2024
Added #
- Added Dartdoc comments to all public members and classes, including exceptions (
LoginError
,WordTooLong
,CreateSocketError
,RouterOSTrapError
). - Renamed anonymous extension to
IntToBytes
for better readability. - Documented the
IntToBytes
extension with a description for thetoBytes
method.
1.0.9 #
Date: September 9, 2024
Fixed #
- Fixed an issue where logs were displayed even when verbose was set to false.
1.0.12 #
Date: September 22, 2024
Added #
-
Support for complex commands in
talk
andstreamData
:talk
andstreamData
methods now accept both simple commands (strings) and complex commands with parameters (Map<String, String>
).- Parameters are automatically converted into the RouterOS command format (
=key=value
).
-
_parseSentence
method:- A new method to parse RouterOS responses into key-value pairs for easier handling of device responses.
Improved #
- Code flexibility and command handling:
- Improved flexibility by allowing both string-based and map-based input for commands sent to the RouterOS device.
- Better handling of both types of inputs while maintaining backward compatibility.
2.0.0 #
Date: June 28, 2025
Added #
-
Tag Support for RouterOS API:
- TaggedResponse class for handling tagged command responses with completion and error status
- TaggedCommand class for batch operations with automatic tag management
- talkTagged() method for individual tagged commands
- talkMultiple() method for concurrent command execution
- cancelTagged() method for cancelling specific commands by tag
-
Enhanced Command Handling:
- Support for complex commands in talk and streamData methods
- Commands now accept both simple strings and complex parameters (Map<String, String>)
- Parameters automatically converted to RouterOS format (=key=value)
-
Response Processing:
- Tag-based response routing system for concurrent operations
- Enhanced error handling with tag-specific error messages
- Stream broadcasting for multiple tagged responses
Improved #
-
Performance:
- Concurrent command execution without multiple socket connections
- Single socket handles multiple simultaneous operations efficiently
- Reduced latency through parallel command processing
-
Code Flexibility:
- Backward compatibility maintained for all existing code
- Optional tag parameters in enhanced talk() and streamData() methods
- Improved command handling with both string and map-based inputs
-
Developer Experience:
- Comprehensive error handling with tag context
- Enhanced logging and debugging capabilities
- Clear separation between tagged and non-tagged operations
Technical Details #
- Full RouterOS API compliance for tag implementation
- Tags sent as .tag=value API attribute words
- Automatic tag generation when not specified
- Proper cleanup of completed tagged commands
- Thread-safe concurrent command management