Crates.io | routeros_rust |
lib.rs | routeros_rust |
version | 0.0.21 |
source | src |
created_at | 2015-05-04 15:33:52.248482 |
updated_at | 2015-12-11 23:55:55.315022 |
description | Mikrotik API for Rust |
homepage | |
repository | https://github.com/Wooowe/mikrotik-rust |
max_upload_size | |
id | 2024 |
size | 8,347 |
Mikrotik API for Rust
This API gives you the ability to connect to your mikrotik router over a tcp connection.
Add router_os via your Cargo.toml
:
[dependencies]
routeros_rust = "*"
[dependencies.routeros_rust]
git = "https://github.com/Wooowe/mikrotik-rust"
extern crate router_os;
use router_os::ApiRos;
use std::net::TcpStream;
fn main() {
let mut stream = TcpStream::connect("192.168.1.1:8728").unwrap();
let mut apiros = ApiRos::new(&mut stream);
apiros.login("admin".to_string(), "".to_string());
apiros.write_sentence(vec!["/ip/address/print".to_string()]);
loop {
let reply = apiros.read_sentence();
if reply.len() == 0 {
continue;
}
if reply[0] == "!done" {
break;
}
}
}