Implemented Soft exit during IP-Fetching

This commit is contained in:
Neshura 2023-02-26 01:14:33 +01:00
parent f2d3fc5fb2
commit ac2db79f21
No known key found for this signature in database
GPG key ID: ACDF5B6EBECF6B0A

View file

@ -1,6 +1,6 @@
use serde_derive::{Deserialize, Serialize};
use reqwest::blocking::get;
use std::fs;
use std::{fs, process::exit};
mod cloudflare;
#[derive(Serialize, Deserialize)]
@ -68,7 +68,10 @@ impl Ips {
match response {
Ok(data) => self.ipv4 = data.text().expect("0.0.0.0").trim_end().to_owned(),
Err(e) => panic!("{:#?}", e)
Err(e) => {
println!("Could not fetch IP4, quitting");
exit(75);
}
}
let response = get(ipv6uri);
@ -82,7 +85,10 @@ impl Ips {
};
self.ipv6base = stripped;
},
Err(e) => panic!("{:#?}", e)
Err(e) => {
println!("Could not fetch IP6, quitting");
exit(75);
}
}
}
}