mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
add wisp v1 flag
This commit is contained in:
parent
50bfa47bc2
commit
273063ec28
1 changed files with 11 additions and 2 deletions
|
@ -68,6 +68,9 @@ struct Cli {
|
||||||
/// `user` cannot contain `:`. Whitespace will be trimmed.
|
/// `user` cannot contain `:`. Whitespace will be trimmed.
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
auth: Option<PathBuf>,
|
auth: Option<PathBuf>,
|
||||||
|
/// Use Wisp V1.
|
||||||
|
#[arg(long)]
|
||||||
|
wisp_v1: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -77,6 +80,7 @@ struct MuxOptions {
|
||||||
pub block_non_http: bool,
|
pub block_non_http: bool,
|
||||||
pub enforce_auth: bool,
|
pub enforce_auth: bool,
|
||||||
pub auth: Arc<Vec<Box<(dyn ProtocolExtensionBuilder + Send + Sync)>>>,
|
pub auth: Arc<Vec<Box<(dyn ProtocolExtensionBuilder + Send + Sync)>>>,
|
||||||
|
pub wisp_v1: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
|
@ -191,6 +195,7 @@ async fn main() -> Result<(), Error> {
|
||||||
Box::new(pw_ext),
|
Box::new(pw_ext),
|
||||||
]),
|
]),
|
||||||
enforce_auth,
|
enforce_auth,
|
||||||
|
wisp_v1: opt.wisp_v1,
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("listening on `{}` with prefix `{}`", addr, prefix);
|
println!("listening on `{}` with prefix `{}`", addr, prefix);
|
||||||
|
@ -315,8 +320,12 @@ async fn accept_ws(
|
||||||
|
|
||||||
println!("{:?}: connected", addr);
|
println!("{:?}: connected", addr);
|
||||||
// to prevent memory ""leaks"" because users are sending in packets way too fast the buffer
|
// to prevent memory ""leaks"" because users are sending in packets way too fast the buffer
|
||||||
// size is set to 512
|
// size is set to 512
|
||||||
let (mux, fut) = if mux_options.enforce_auth {
|
let (mux, fut) = if mux_options.wisp_v1 {
|
||||||
|
ServerMux::create(rx, tx, 512, None)
|
||||||
|
.await?
|
||||||
|
.with_no_required_extensions()
|
||||||
|
} else if mux_options.enforce_auth {
|
||||||
ServerMux::create(rx, tx, 512, Some(mux_options.auth.as_slice()))
|
ServerMux::create(rx, tx, 512, Some(mux_options.auth.as_slice()))
|
||||||
.await?
|
.await?
|
||||||
.with_required_extensions(&[PasswordProtocolExtension::ID])
|
.with_required_extensions(&[PasswordProtocolExtension::ID])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue