From cf6578e6bc20c26abab650da49d0b8619b5b1aca Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Sat, 1 Feb 2025 00:00:29 -0300 Subject: [PATCH] removed test callback --- src/lib.rs | 1 - src/util.rs | 21 ++++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ba792f4..d4f29ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,6 @@ pub fn init() -> Extension { ) .command("local_ip", util::get_local_address) .command("uuid", util::get_uuid) - .command("callback", util::test_callback) .command("log", util::log_info) .group( "cot_router", diff --git a/src/util.rs b/src/util.rs index 07b19d4..e5f51d0 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,14 +1,13 @@ -use arma_rs::Context; +use crate::structs::LogPayload; use log::{error, info, warn}; use std::net::{IpAddr, UdpSocket}; -use crate::structs::LogPayload; pub fn log_info(data: LogPayload) -> String { match data.status.as_str() { "info" => info!("{}", data.message), "warn" => warn!("{}", data.message), "error" => error!("{}", data.message), - _ => error!("{}","Wrong log call") + _ => error!("{}", "Wrong log call"), } "logged".to_string() } @@ -18,15 +17,13 @@ pub fn get_uuid() -> String { let id = Uuid::new_v4().to_string(); - return id + return id; } pub fn get_local_address() -> String { fn get_local_ip() -> Result { let socket = UdpSocket::bind("0.0.0.0:0").map_err(|e| e.to_string())?; - socket - .connect("8.8.8.8:80") - .map_err(|e| e.to_string())?; + socket.connect("8.8.8.8:80").map_err(|e| e.to_string())?; socket .local_addr() .map(|addr| addr.ip()) @@ -38,15 +35,9 @@ pub fn get_local_address() -> String { match parsed_data { Ok(ip) => { return format!("ws://{}:4152", ip.to_string()); - }, + } Err(_) => { return "not provided".to_string(); - }, + } } } - -pub fn test_callback(ctx: Context) -> &'static str { - let _ = ctx.callback_data("armatak_test_callback", "123", "321"); - - "Testing Callback" -}