From a5d0dd1653b564a56a224fe374503cb63c511cc1 Mon Sep 17 00:00:00 2001 From: gennyble Date: Fri, 4 Apr 2025 04:38:33 -0500 Subject: refactor --- corgi/src/main.rs | 177 ++++++-------------------------------------------- corgi/src/settings.rs | 82 +++++++++++++++++++++++ corgi/src/stats.rs | 4 +- corgi/src/util.rs | 66 +++++++++++++++++++ 4 files changed, 169 insertions(+), 160 deletions(-) create mode 100644 corgi/src/settings.rs create mode 100644 corgi/src/util.rs diff --git a/corgi/src/main.rs b/corgi/src/main.rs index 7f94ba2..1772d68 100644 --- a/corgi/src/main.rs +++ b/corgi/src/main.rs @@ -1,109 +1,34 @@ use core::fmt; -use std::{ - net::{IpAddr, SocketAddr}, - path::PathBuf, - pin::Pin, - sync::Arc, -}; +use std::{net::SocketAddr, pin::Pin, sync::Arc}; use caller::HttpRequest; -use confindent::{Confindent, Value, ValueParseError}; use http_body_util::{BodyExt, Full}; use hyper::{ HeaderMap, Request, Response, StatusCode, body::{Bytes, Incoming}, - header::HeaderValue, server::conn::http1, service::Service, }; use hyper_util::rt::TokioIo; -use regex_lite::Regex; +use settings::{Script, Settings}; use stats::Stats; use tokio::{net::TcpListener, runtime::Runtime}; +use util::owned_header; mod caller; +mod settings; mod stats; - -#[derive(Clone, Debug)] -pub struct Settings { - port: u16, - scripts: Vec