Crate myip_foo

Crate myip_foo 

Source
Expand description

§myip-foo

Official Rust client for myip.foo - a free, privacy-focused IP lookup API.

§Features

  • Async/await support with tokio
  • Full type definitions with serde
  • Dual-stack IPv4/IPv6 support
  • Connection type detection
  • No API key required

§Quick Start

use myip_foo::{get_ip, get_ip_data};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Get plain IP
    let ip = get_ip().await?;
    println!("IP: {}", ip);

    // Get full data
    let data = get_ip_data().await?;
    println!("City: {}", data.location.city);

    Ok(())
}

Structs§

Cloudflare
Cloudflare information
ConnectionTypeData
Connection type data
DualStackData
Dual-stack IPv4/IPv6 data
IpData
Full IP data including geolocation
Location
Location information
Network
Network information

Enums§

Error
Error type for myip-foo operations

Functions§

get_connection_type
Get connection type (residential, vpn, datacenter).
get_dual_stack
Get both IPv4 and IPv6 addresses.
get_headers
Get all HTTP headers as seen by the server.
get_ip
Get your IP address as plain text.
get_ip_data
Get full IP data including geolocation.
get_user_agent
Get your user agent string.

Type Aliases§

Result
Result type for myip-foo operations