use std::time::Duration; use mikrotik_lite::MikrotikLite; use serde::{Deserialize}; use serde_aux::prelude::{deserialize_bool_from_anything}; #[tokio::main] async fn main() { let mut api = MikrotikLite::new_async( "api_login".to_string(), "api_pass".to_string(), "10.80.80.1:8728".to_string(), Duration::from_secs(2) ).await.unwrap(); let identity_json = api.send_command_async::( "/ip/route/print".to_string(), None ).await.unwrap(); println!("{:#?}", identity_json); } #[allow(dead_code)] #[derive(Debug, Deserialize)] struct Route { #[serde(rename = "dst-address")] pub dst_address: String, #[serde(rename = ".id")] pub id: String, #[serde(deserialize_with = "deserialize_bool_from_anything")] pub inactive: bool, #[serde(rename = "routing-table")] pub routing_table: String, pub gateway: String, #[serde(rename = "local-address")] pub local_address: Option, #[serde(rename = "immediate-gw")] pub immediate_gw: Option }