diff options
Diffstat (limited to 'src/utils/pub_ip.rs')
-rw-r--r-- | src/utils/pub_ip.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/utils/pub_ip.rs b/src/utils/pub_ip.rs index ce2da92..c0e6e4c 100644 --- a/src/utils/pub_ip.rs +++ b/src/utils/pub_ip.rs @@ -1,15 +1,17 @@ use crate::config::CONFIG; +use crate::types::ThreadsData; -pub fn get_pub_ip() -> String { +pub fn get_pub_ip() -> ThreadsData { let url = format!("http://api.ipify.org"); - let err_string = String::from("Error"); + let _err = String::from("Error"); let res = match minreq::get(url).send() { Ok(resp) => match resp.as_str() { Ok(res_str) => res_str.trim().to_string(), - Err(_) => err_string, + Err(_) => _err, }, - Err(_) => err_string, + Err(_) => _err, }; - format!(" {} {} {}", CONFIG.pub_ip.icon, res, CONFIG.seperator) + let data = format!(" {} {} {}", CONFIG.pub_ip.icon, res, CONFIG.seperator); + ThreadsData::PubIp(data) } |