mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-09 04:55:27 +00:00
formatting
This commit is contained in:
parent
46866c4320
commit
aa713a2dea
1 changed files with 13 additions and 12 deletions
25
src/main.rs
25
src/main.rs
|
|
@ -9,15 +9,8 @@ use {
|
||||||
NoClientAuth, ServerConfig,
|
NoClientAuth, ServerConfig,
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
borrow::Cow,
|
borrow::Cow, error::Error, ffi::OsStr, fmt::Write, fs::File, io::BufReader,
|
||||||
error::Error,
|
net::SocketAddr, path::Path, sync::Arc,
|
||||||
ffi::OsStr,
|
|
||||||
fmt::Write,
|
|
||||||
fs::File,
|
|
||||||
io::BufReader,
|
|
||||||
net::SocketAddr,
|
|
||||||
path::Path,
|
|
||||||
sync::Arc,
|
|
||||||
},
|
},
|
||||||
tokio::{
|
tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
|
|
@ -122,7 +115,11 @@ fn args() -> Result<Args> {
|
||||||
);
|
);
|
||||||
opts.optflag("s", "silent", "Disable logging output");
|
opts.optflag("s", "silent", "Disable logging output");
|
||||||
opts.optflag("h", "help", "Print this help menu");
|
opts.optflag("h", "help", "Print this help menu");
|
||||||
opts.optflag("", "serve-secret", "Enable serving secret files (files/directories starting with a dot)");
|
opts.optflag(
|
||||||
|
"",
|
||||||
|
"serve-secret",
|
||||||
|
"Enable serving secret files (files/directories starting with a dot)",
|
||||||
|
);
|
||||||
opts.optflag("", "log-ip", "Output IP addresses when logging");
|
opts.optflag("", "log-ip", "Output IP addresses when logging");
|
||||||
|
|
||||||
let matches = opts.parse(&args[1..]).map_err(|f| f.to_string())?;
|
let matches = opts.parse(&args[1..]).map_err(|f| f.to_string())?;
|
||||||
|
|
@ -153,7 +150,7 @@ fn args() -> Result<Args> {
|
||||||
language: matches.opt_str("lang"),
|
language: matches.opt_str("lang"),
|
||||||
silent: matches.opt_present("s"),
|
silent: matches.opt_present("s"),
|
||||||
serve_secret: matches.opt_present("serve-secret"),
|
serve_secret: matches.opt_present("serve-secret"),
|
||||||
log_ips: matches.opt_present("log-ip"),
|
log_ips: matches.opt_present("log-ip"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,7 +202,11 @@ impl RequestHandle {
|
||||||
);
|
);
|
||||||
|
|
||||||
match TLS.accept(stream).await {
|
match TLS.accept(stream).await {
|
||||||
Ok(stream) => Ok(Self { stream, log_line, metadata }),
|
Ok(stream) => Ok(Self {
|
||||||
|
stream,
|
||||||
|
log_line,
|
||||||
|
metadata,
|
||||||
|
}),
|
||||||
Err(e) => Err(format!("{} error:{}", log_line, e)),
|
Err(e) => Err(format!("{} error:{}", log_line, e)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue