From 52c1e764784868833cb26f443846aafd9537a752 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Thu, 7 Nov 2019 12:48:23 +0100 Subject: [PATCH] Fix #87: pick up IP in US for heartbeat --- src/endpoints/classify.rs | 2 +- src/endpoints/dockerflow.rs | 2 +- src/geoip.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/endpoints/classify.rs b/src/endpoints/classify.rs index 40b7bc5..41ab245 100644 --- a/src/endpoints/classify.rs +++ b/src/endpoints/classify.rs @@ -114,7 +114,7 @@ mod tests { .route("/", web::get().to(super::classify_client)), ); - let request = TestRequest::with_header("x-forwarded-for", "1.2.3.4").to_request(); + let request = TestRequest::with_header("x-forwarded-for", "7.7.7.7").to_request(); let value: serde_json::Value = test::read_response_json(&mut service, request); assert_eq!( *value.get("country").unwrap(), diff --git a/src/endpoints/dockerflow.rs b/src/endpoints/dockerflow.rs index 2a4d0ac..aeeb24d 100644 --- a/src/endpoints/dockerflow.rs +++ b/src/endpoints/dockerflow.rs @@ -17,7 +17,7 @@ struct HeartbeatResponse { } pub fn heartbeat(app_data: Data) -> Result { - let ip = IpAddr::V4(Ipv4Addr::new(1, 2, 3, 4)); + let ip = IpAddr::V4(Ipv4Addr::new(7, 7, 7, 7)); app_data .geoip diff --git a/src/geoip.rs b/src/geoip.rs index 994ac33..7ead5ee 100644 --- a/src/geoip.rs +++ b/src/geoip.rs @@ -114,7 +114,7 @@ mod tests { .path("./GeoLite2-Country.mmdb") .build()?; - let ip = "1.2.3.4".parse()?; + let ip = "7.7.7.7".parse()?; let rv = geoip.locate(ip).unwrap().unwrap(); assert_eq!(rv.country.unwrap().iso_code.unwrap(), "US"); Ok(()) @@ -129,7 +129,7 @@ mod tests { .metrics(metrics) .build()?; - geoip.locate("1.2.3.4".parse()?)?; + geoip.locate("7.7.7.7".parse()?)?; geoip.locate("127.0.0.1".parse()?)?; assert_eq!(