aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/protocols/digest.rs13
-rw-r--r--pingora-core/src/protocols/l4/ext.rs7
3 files changed, 20 insertions, 2 deletions
diff --git a/.bleep b/.bleep
index 1ac3b4f..4611476 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-73cbdf49b1e1279ebba51525cad01952d4dc04d2 \ No newline at end of file
+9d8254e966aca99eeb6623f2bcf5fc93facbb05a \ No newline at end of file
diff --git a/pingora-core/src/protocols/digest.rs b/pingora-core/src/protocols/digest.rs
index 9e23741..19dc78d 100644
--- a/pingora-core/src/protocols/digest.rs
+++ b/pingora-core/src/protocols/digest.rs
@@ -162,6 +162,7 @@ impl SocketDigest {
}
}
+ #[cfg(unix)]
pub fn original_dst(&self) -> Option<&SocketAddr> {
self.original_dst
.get_or_init(|| {
@@ -172,6 +173,18 @@ impl SocketDigest {
})
.as_ref()
}
+
+ #[cfg(windows)]
+ pub fn original_dst(&self) -> Option<&SocketAddr> {
+ self.original_dst
+ .get_or_init(|| {
+ get_original_dest(self.raw_sock)
+ .ok()
+ .flatten()
+ .map(SocketAddr::Inet)
+ })
+ .as_ref()
+ }
}
/// The interface to return timing information
diff --git a/pingora-core/src/protocols/l4/ext.rs b/pingora-core/src/protocols/l4/ext.rs
index fae93f7..b687cc4 100644
--- a/pingora-core/src/protocols/l4/ext.rs
+++ b/pingora-core/src/protocols/l4/ext.rs
@@ -413,11 +413,16 @@ pub fn get_original_dest(fd: RawFd) -> Result<Option<SocketAddr>> {
.map(Some)
}
-#[cfg(not(target_os = "linux"))]
+#[cfg(all(unix, not(target_os = "linux")))]
pub fn get_original_dest(_fd: RawFd) -> Result<Option<SocketAddr>> {
Ok(None)
}
+#[cfg(windows)]
+pub fn get_original_dest(_sock: RawSocket) -> Result<Option<SocketAddr>> {
+ Ok(None)
+}
+
/// connect() to the given address while optionally binding to the specific source address and port range.
///
/// The `set_socket` callback can be used to tune the socket before `connect()` is called.