From 4552033ff09e34f5f2338bb881ea060c77dc1168 Mon Sep 17 00:00:00 2001 From: DanGould Date: Tue, 20 Feb 2024 21:35:58 -0500 Subject: [PATCH 1/3] Avoid DNS lookup in test for compatibility DNS lookup seemed to fail on NixOS --- src/bootstrap/connect.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/connect.rs b/src/bootstrap/connect.rs index 154b3d9..609dc69 100644 --- a/src/bootstrap/connect.rs +++ b/src/bootstrap/connect.rs @@ -65,11 +65,11 @@ mod test { use super::*; - static GATEWAY_ORIGIN: Lazy = Lazy::new(|| Uri::from_static("https://gateway.com")); + static GATEWAY_ORIGIN: Lazy = Lazy::new(|| Uri::from_static("https://0.0.0.0:8080")); #[test] fn mismatched_gateways_not_allowed() { - let not_gateway_origin = "https://not-gateway.com"; + let not_gateway_origin = "https://0.0.0.0:8081"; let req = hyper::Request::builder().uri(not_gateway_origin).body(()).unwrap(); let allowable_gateway = find_allowable_gateway(&req, &*GATEWAY_ORIGIN); assert!(allowable_gateway.is_none()); From 2e72dbebcadd06d3043c68aaf1767df346b038b3 Mon Sep 17 00:00:00 2001 From: DanGould Date: Tue, 20 Feb 2024 21:36:42 -0500 Subject: [PATCH 2/3] Use 0.0.0.0 loopback for compatibility --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 28505d7..9de97d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,7 @@ pub async fn listen_tcp( port: u16, gateway_origin: Uri, ) -> Result<(), Box> { - let addr = SocketAddr::from(([127, 0, 0, 1], port)); + let addr = SocketAddr::from(([0, 0, 0, 0], port)); let listener = TcpListener::bind(addr).await?; println!("OHTTP relay listening on tcp://{}", addr); ohttp_relay(listener, gateway_origin).await From 6fb0d060a487b3b9dcd15f8aa38c025ce58dd418 Mon Sep 17 00:00:00 2001 From: DanGould Date: Tue, 20 Feb 2024 21:39:32 -0500 Subject: [PATCH 3/3] Bump v0.0.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 740a9aa..9e9c043 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -538,7 +538,7 @@ dependencies = [ [[package]] name = "ohttp-relay" -version = "0.0.2" +version = "0.0.3" dependencies = [ "futures", "hex-conservative", diff --git a/Cargo.toml b/Cargo.toml index bac2f06..8052734 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ohttp-relay" -version = "0.0.2" +version = "0.0.3" authors = ["Dan Gould "] description = "Relay Oblivious HTTP requests to protect IP metadata" repository = "https://github.com/payjoin/ohttp-relay"