workflow-utils 0.19.0

Miscellaneous utilities for the workflow-rs ecosystem.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::imports::*;

/// Asynchronously resolves the host's public IP address via the ipify service.
pub async fn public() -> Result<String> {
    Ok(http::get("https://api.ipify.org").await?)
}

/// Blocking (non-`wasm32`) variants of the IP lookup helpers.
#[cfg(not(target_arch = "wasm32"))]
pub mod blocking {
    use super::*;

    /// Synchronously resolves the host's public IP address via the ipify service.
    pub fn public() -> Result<String> {
        Ok(reqwest::blocking::get("https://api.ipify.org")?.text()?)
    }
}