diff options
| author | Fuwn <[email protected]> | 2023-04-06 07:38:27 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-06 07:38:27 +0000 |
| commit | 50601e3248865f4c4735ea44ae0ebd253be96397 (patch) | |
| tree | b3ce54c417a8996e51e6e92c7bbf2c85e4ca7c3d /src/context/hook.rs | |
| parent | refactor(router): simplify context creation (diff) | |
| download | windmark-50601e3248865f4c4735ea44ae0ebd253be96397.tar.xz windmark-50601e3248865f4c4735ea44ae0ebd253be96397.zip | |
feat(context): bring back peer address
Diffstat (limited to 'src/context/hook.rs')
| -rw-r--r-- | src/context/hook.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/context/hook.rs b/src/context/hook.rs index 94a6908..6a4fe72 100644 --- a/src/context/hook.rs +++ b/src/context/hook.rs @@ -23,19 +23,22 @@ use url::Url; #[allow(clippy::module_name_repetitions)] #[derive(Clone)] pub struct HookContext<'a> { - pub url: Url, - pub params: Option<Params<'a, 'a>>, - pub certificate: Option<X509>, + pub peer_address: Option<std::net::SocketAddr>, + pub url: Url, + pub params: Option<Params<'a, 'a>>, + pub certificate: Option<X509>, } impl<'a> HookContext<'a> { #[must_use] - pub const fn new( + pub fn new( + peer_address: std::io::Result<std::net::SocketAddr>, url: Url, params: Option<Params<'a, 'a>>, certificate: Option<X509>, ) -> Self { Self { + peer_address: peer_address.ok(), url, params, certificate, |