mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -04:00
fix twisp extension
This commit is contained in:
parent
5e4461d61d
commit
95d7b101a0
3 changed files with 9 additions and 4 deletions
|
@ -221,7 +221,7 @@ pub async fn handle_wisp(stream: WispResult, id: String) -> anyhow::Result<()> {
|
|||
|
||||
let extensions = match extensions {
|
||||
Some(mut exts) => {
|
||||
exts.push(twisp::new_ext(twisp_map.clone()));
|
||||
exts.add_extension(twisp::new_ext(twisp_map.clone()));
|
||||
Some(exts)
|
||||
},
|
||||
None => {
|
||||
|
|
|
@ -10,7 +10,7 @@ use pty_process::{Pty, Size};
|
|||
use tokio::{io::copy, process::Child, select, sync::Mutex};
|
||||
use tokio_util::compat::{FuturesAsyncReadCompatExt, FuturesAsyncWriteCompatExt};
|
||||
use wisp_mux::{
|
||||
extensions::{AnyProtocolExtension, ProtocolExtension, ProtocolExtensionBuilder},
|
||||
extensions::{AnyProtocolExtension, ProtocolExtension, ProtocolExtensionBuilder, AnyProtocolExtensionBuilder},
|
||||
ws::{LockedWebSocketWrite, WebSocketRead},
|
||||
MuxStreamAsyncRead, MuxStreamAsyncWrite, WispError,
|
||||
};
|
||||
|
@ -120,8 +120,8 @@ pub fn new_map() -> TwispMap {
|
|||
Arc::new(Mutex::new(HashMap::new()))
|
||||
}
|
||||
|
||||
pub fn new_ext(map: TwispMap) -> Box<dyn ProtocolExtensionBuilder + Send + Sync> {
|
||||
Box::new(TWispServerProtocolExtensionBuilder(map))
|
||||
pub fn new_ext(map: TwispMap) -> AnyProtocolExtensionBuilder {
|
||||
AnyProtocolExtensionBuilder::new(TWispServerProtocolExtensionBuilder(map))
|
||||
}
|
||||
|
||||
pub async fn handle_twisp(
|
||||
|
|
|
@ -263,6 +263,11 @@ impl WispV2Extensions {
|
|||
closure: Box::new(closure),
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a Wisp V2 extension builder to the settings struct.
|
||||
pub fn add_extension(&mut self, extension: AnyProtocolExtensionBuilder) {
|
||||
self.builders.push(extension);
|
||||
}
|
||||
}
|
||||
|
||||
/// Server-side multiplexor.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue