♻️ Use a prelude to clean up the unused imports for `tracing`
parent
c5691d9d05
commit
435232bf6c
|
@ -17,12 +17,10 @@ use hyper::{
|
|||
StatusCode,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tracing::{
|
||||
debug, error, info, trace, warn,
|
||||
};
|
||||
|
||||
use ptth::{
|
||||
http_serde::RequestParts,
|
||||
prelude::*,
|
||||
server::file_server,
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ use tokio::{
|
|||
sync::oneshot,
|
||||
time::delay_for,
|
||||
};
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn init () -> oneshot::Receiver <()> {
|
||||
let (tx, rx) = oneshot::channel::<()> ();
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
pub mod http_serde;
|
||||
|
||||
// It's easier if the server can stream its response body
|
||||
// back to the relay un-changed inside its request body
|
||||
// So we wrap the server's actual response head
|
||||
|
@ -7,12 +5,11 @@ pub mod http_serde;
|
|||
|
||||
pub const PTTH_MAGIC_HEADER: &str = "X-PTTH-2LJYXWC4";
|
||||
|
||||
// Basically binaries, but in the lib we can do experimental
|
||||
// test stuff like spawn them both in the same process
|
||||
|
||||
pub mod git_version;
|
||||
pub mod graceful_shutdown;
|
||||
pub mod http_serde;
|
||||
pub mod load_toml;
|
||||
pub mod prelude;
|
||||
pub mod relay;
|
||||
pub mod server;
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
pub use tracing::{debug, error, info, trace, warn};
|
|
@ -23,15 +23,13 @@ use tokio::{
|
|||
channel,
|
||||
},
|
||||
};
|
||||
use tracing::{
|
||||
debug, error, info, trace, warn,
|
||||
instrument,
|
||||
};
|
||||
use tracing::instrument;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
use crate::{
|
||||
http_serde,
|
||||
prelude::*,
|
||||
prefix_match,
|
||||
};
|
||||
|
||||
|
|
|
@ -16,11 +16,10 @@ use tokio::{
|
|||
sync::oneshot,
|
||||
time::delay_for,
|
||||
};
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
use crate::{
|
||||
http_serde,
|
||||
prefix_match,
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
pub mod file_server;
|
||||
|
@ -32,14 +31,6 @@ struct ServerState {
|
|||
hidden_path: Option <PathBuf>,
|
||||
}
|
||||
|
||||
fn status_reply (c: http_serde::StatusCode, body: &str) -> http_serde::Response
|
||||
{
|
||||
let mut r = http_serde::Response::default ();
|
||||
r.status_code (c)
|
||||
.body_bytes (body.as_bytes ().to_vec ());
|
||||
r
|
||||
}
|
||||
|
||||
async fn handle_req_resp <'a> (
|
||||
state: &Arc <ServerState>,
|
||||
req_resp: reqwest::Response
|
||||
|
|
Loading…
Reference in New Issue