This commit is contained in:
Neshura 2023-03-15 21:36:52 +01:00
parent 6540041f4b
commit 5186bded04
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -272,8 +272,13 @@ impl Ips {
match get(ipv4uri) {
Ok(data) => {
if data.status() == 200 {
self.ipv4 = data.text().expect("0.0.0.0").trim_end().to_owned();
ret = true;
}
else {
ret = false;
}
},
Err(_e) => {
println!("Could not fetch IPv4");
@ -285,6 +290,7 @@ impl Ips {
match get(ipv6uri) {
Ok(data) => {
if data.status() == 200 {
let ipv6 = match data.text() {
Ok(ip) => {ip},
Err(_) => {panic!("Expected IP, found none")},
@ -296,6 +302,10 @@ impl Ips {
self.ipv6base = stripped;
ret = true && ret; // Only set ret to true if previous ret is also true
}
else {
ret = false;
}
}
Err(_e) => {
println!("Could not fetch IPv6");
ret = false;