Compare commits

..

2 commits

Author SHA1 Message Date
hex
8092c07ee6 chore: cargo fix 2025-08-02 20:43:23 +02:00
hex
89df8c684b chore: cargo fmt 2025-08-02 20:41:28 +02:00
7 changed files with 18 additions and 33 deletions

View file

@ -1,8 +1,7 @@
use std::{error::Error, net::IpAddr};
use json::JsonValue;
use log::warn;
use tokio_postgres::{Client, Row, Statement};
use tokio_postgres::{Client, Row};
const ENDPOINT_TABLE: &str = "endpoints";
const HOSTS_RELATION_TABLE: &str = "hosts";

View file

@ -26,7 +26,7 @@ pub async fn check(db: &mut BoxyDatabase) {
continue;
}
};
let io = TokioIo::new(stream);
let (mut sender, conn) = hyper::client::conn::http1::handshake(io).await.unwrap();

View file

@ -16,11 +16,11 @@ use matchers::api::ApiMatcher;
use server::Server;
use services::{
controller::ControllerService,
matcher::{Matcher, MatcherService},
matcher::Matcher,
};
use tokio::{
sync::Mutex,
time::{self, interval},
time::{self},
};
use tokio_postgres::NoTls;

View file

@ -1,13 +1,11 @@
use std::{net::IpAddr, pin::Pin, sync::Arc};
use std::{net::IpAddr, sync::Arc};
use async_trait::async_trait;
use base64::{Engine, prelude::BASE64_STANDARD};
use http::request::Parts;
use http_body_util::BodyExt;
use hyper::{
Method, Request, StatusCode,
body::{self, Incoming},
service::Service,
Request, StatusCode,
body::Incoming,
};
use json::JsonValue;
use log::{debug, error, warn};
@ -15,10 +13,10 @@ use tokio::{net::TcpStream, sync::Mutex};
use crate::{
config::{Client, Config},
db::{BoxyDatabase, Endpoint},
db::BoxyDatabase,
routes::api::{AddHost, RegisterEndpoint, RemoveHost},
server::{GeneralResponse, TcpIntercept, custom_resp, default_response, json_to_vec},
services::matcher::{Matcher, MatcherService},
server::{GeneralResponse, custom_resp},
services::matcher::Matcher,
};
#[derive(Debug, Clone)]

View file

@ -1,12 +1,9 @@
use async_trait::async_trait;
use base64::{Engine, prelude::BASE64_STANDARD};
use http::request::Parts;
use http_body_util::BodyExt;
use hyper::{Method, StatusCode};
use log::{debug, error, warn};
use log::error;
use crate::{
config::Client,
db::Endpoint,
matchers::api::ApiMatcher,
server::{custom_resp, json_to_vec},

View file

@ -1,3 +1,3 @@
pub mod controller;
pub mod proxy;
pub mod matcher;
pub mod proxy;

View file

@ -1,22 +1,11 @@
use std::{net::IpAddr, pin::Pin, sync::Arc};
use std::{pin::Pin, sync::Arc};
use async_trait::async_trait;
use base64::{Engine, prelude::BASE64_STANDARD};
use http::request::Parts;
use http_body_util::BodyExt;
use hyper::{
Method, Request, StatusCode,
body::{self, Incoming},
service::Service,
};
use log::{debug, error, warn};
use tokio::{net::TcpStream, sync::Mutex};
use hyper::{Request, StatusCode, body::Incoming, service::Service};
use tokio::net::TcpStream;
use crate::{
config::{Client, Config},
db::{BoxyDatabase, Endpoint},
server::{GeneralResponse, TcpIntercept, custom_resp, default_response, json_to_vec},
};
use crate::server::{GeneralResponse, TcpIntercept, custom_resp, default_response};
// The routes itself
#[async_trait]
@ -47,9 +36,11 @@ pub trait Matcher: Clone + Send + Sync + 'static {
}
// Do something with TCP stream
#[allow(unused_variables)]
fn stream(&mut self, stream: &TcpStream) {}
// Body parser - made universal for api server cause lazy
#[allow(unused_variables)]
async fn body(&mut self, body: Incoming) -> Option<Result<GeneralResponse, hyper::Error>> {
None
}