Concurrently get ipv4 and ipv6 addresses

This commit is contained in:
Kaan Barmore-Genç 2023-02-01 00:13:29 -05:00
parent 963dac8656
commit ed6c587382
Signed by: kaan
GPG Key ID: B2E280771CD62FCF
1 changed files with 1 additions and 2 deletions

View File

@ -43,8 +43,7 @@ pub struct APIPayload {
async fn run(base_url: &str, ip_source: &Box<dyn IPSource>, conf: &Config) -> anyhow::Result<()> {
config::validate_config(conf).die_with(|error| format!("Invalid config: {}", error));
println!("Finding out the IP address...");
let ipv4_result = ip_source.get_ipv4().await;
let ipv6_result = ip_source.get_ipv6().await;
let (ipv4_result, ipv6_result) = join!(ip_source.get_ipv4(), ip_source.get_ipv6());
let ipv4 = ipv4_result.as_ref();
let ipv6 = ipv6_result.as_ref();
println!("Found these:");