---
title: geo_lookup
summary: Look up the geographic data associated with a particular IP address.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/geo/fn.geo_lookup/
---

**Kind:** Function  
**Module:** [geo](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/geo/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#27

```rust
fn geo_lookup(ip: IpAddr) -> Option<Geo>
```

Look up the geographic data associated with a particular IP address.

Returns `None` if no geographic data is available, such as when the IP address is reserved for
private use.

#### Examples

To get geographic information for the downstream client:

```rust
let client_ip = fastly::Request::from_client().get_client_ip_addr().unwrap();
if let Some(geo) = fastly::geo::geo_lookup(client_ip) {
    if let fastly::geo::ConnType::Satellite = geo.conn_type() {
        println!("receiving a request from outer space 🛸");
    }
}
```

**Parameters**

- `ip`: `std::net::IpAddr`

**Returns**

`Option<Geo>`
