| Crates.io | ipwhois_rs |
| lib.rs | ipwhois_rs |
| version | 0.1.0 |
| created_at | 2025-07-24 07:01:36.287058+00 |
| updated_at | 2025-07-24 07:01:36.287058+00 |
| description | Rust wrapper for the ipwhois.io geolocation API |
| homepage | https://github.com/Junaid433/ipwhois_rs |
| repository | https://github.com/Junaid433/ipwhois_rs |
| max_upload_size | |
| id | 1765642 |
| size | 56,480 |
A Rust wrapper library for IP whois and geolocation lookup using ipwhois.io API.
use ipwhois_rs::IpWhoIs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = IpWhoIs::new();
let info = client.lookup("8.8.4.4").await?;
println!("IP: {}", info.ip);
println!("Country: {} ({})", info.country, info.country_code);
println!("City: {}", info.city);
println!("Latitude: {}", info.latitude);
println!("Longitude: {}", info.longitude);
println!("Flag Emoji: {}", info.flag.emoji);
println!("ISP: {}", info.connection.isp);
println!("Timezone: {}", info.timezone.id);
Ok(())
}
The IpWhoIsResponse struct contains detailed information returned by the API.
String): Queried IP address.bool): Whether the lookup was successful.String): IP type, e.g., "IPv4" or "IPv6".String): Continent name (e.g., "North America").String): Continent code (e.g., "NA").String): Country name (e.g., "United States").String): Country code (e.g., "US").String): Region or state name (e.g., "California").String): Region code (e.g., "CA").String): City name (e.g., "Mountain View").f64): Latitude coordinate.f64): Longitude coordinate.bool): Whether the IP belongs to the European Union.String): Postal or ZIP code.String): International telephone calling code.String): Capital city of the country.String): Bordering countries or regions.Flag): Country flag information.Connection): ISP and ASN info.TimeZone): Timezone info.String): URL to the country flag image.String): Country flag emoji.String): Unicode points for the emoji flag.i32): Autonomous System Number.String): Organization (ISP or company).String): Internet Service Provider name.String): Domain associated with the connection.String): Timezone identifier (e.g., "America/Los_Angeles").String): Timezone abbreviation (e.g., "PDT").bool): Whether daylight saving time is active.i32): Offset in seconds from UTC (e.g., -25200).String): UTC offset as a string (e.g., "-07:00").String): Current local time in the timezone.MIT © 2025 Junaid Rahman(https://github.com/junaid433)