summaryrefslogtreecommitdiff
path: root/src/modules/proxy.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-11-14 20:11:18 +0100
committermetamuffin <metamuffin@disroot.org>2025-11-14 20:11:18 +0100
commit2e2807f022294d424f06206b8311bd3ad7b16f14 (patch)
tree93411244c5cd105a28ccb19d80d1f22c7864c6b9 /src/modules/proxy.rs
parent06e736c7947e3ae43779d8035542896a78227fa0 (diff)
downloadgnix-2e2807f022294d424f06206b8311bd3ad7b16f14.tar
gnix-2e2807f022294d424f06206b8311bd3ad7b16f14.tar.bz2
gnix-2e2807f022294d424f06206b8311bd3ad7b16f14.tar.zst
preparation for config reloading
Diffstat (limited to 'src/modules/proxy.rs')
-rw-r--r--src/modules/proxy.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/proxy.rs b/src/modules/proxy.rs
index aecd775..252e482 100644
--- a/src/modules/proxy.rs
+++ b/src/modules/proxy.rs
@@ -4,7 +4,8 @@
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use super::{Node, NodeContext, NodeKind, NodeRequest, NodeResponse};
-use crate::ServiceError;
+use crate::{config::DynNode, modules::InstContext, ServiceError};
+use anyhow::Result;
use futures::Future;
use http::{Response, Version};
use http_body_util::BodyExt;
@@ -12,7 +13,6 @@ use hyper::{body::Incoming, http::HeaderValue, upgrade::OnUpgrade, StatusCode};
use hyper_util::rt::TokioIo;
use log::{debug, warn};
use serde::Deserialize;
-use serde_yml::Value;
use std::{
fmt::Display,
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
@@ -53,8 +53,8 @@ impl NodeKind for ProxyKind {
fn name(&self) -> &'static str {
"proxy"
}
- fn instanciate(&self, config: Value) -> anyhow::Result<Arc<dyn Node>> {
- Ok(Arc::new(serde_yml::from_value::<Proxy>(config)?))
+ fn instanciate(&self, ic: InstContext) -> Result<DynNode> {
+ Ok(Arc::new(ic.config().parse::<Proxy>()?))
}
}