aboutsummaryrefslogtreecommitdiff
path: root/src/context/route.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-04-06 07:38:27 +0000
committerFuwn <[email protected]>2023-04-06 07:38:27 +0000
commit50601e3248865f4c4735ea44ae0ebd253be96397 (patch)
treeb3ce54c417a8996e51e6e92c7bbf2c85e4ca7c3d /src/context/route.rs
parentrefactor(router): simplify context creation (diff)
downloadwindmark-50601e3248865f4c4735ea44ae0ebd253be96397.tar.xz
windmark-50601e3248865f4c4735ea44ae0ebd253be96397.zip
feat(context): bring back peer address
Diffstat (limited to 'src/context/route.rs')
-rw-r--r--src/context/route.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/context/route.rs b/src/context/route.rs
index b3b105d..9ff0b03 100644
--- a/src/context/route.rs
+++ b/src/context/route.rs
@@ -23,19 +23,22 @@ use url::Url;
#[allow(clippy::module_name_repetitions)]
#[derive(Clone)]
pub struct RouteContext<'a> {
- pub url: Url,
- pub params: Params<'a, 'a>,
- pub certificate: Option<X509>,
+ pub peer_address: Option<std::net::SocketAddr>,
+ pub url: Url,
+ pub params: Params<'a, 'a>,
+ pub certificate: Option<X509>,
}
impl<'a> RouteContext<'a> {
#[must_use]
- pub const fn new(
+ pub fn new(
+ peer_address: std::io::Result<std::net::SocketAddr>,
url: Url,
params: Params<'a, 'a>,
certificate: Option<X509>,
) -> Self {
Self {
+ peer_address: peer_address.ok(),
url,
params,
certificate,