[enhance] test ver. Add text for test.

This commit is contained in:
YinMo19 2025-04-24 03:11:54 +08:00
parent 29a322e6e3
commit 7d5cc2ed47
2 changed files with 6 additions and 34 deletions

View file

@ -117,23 +117,6 @@ impl Stream {
Stream::Tcp(s) => s.next_timeout(timeout).await,
}
}
}
impl Stream {
/// establish connect from tcp.
pub async fn from_tcp(
stream: tokio::net::TcpStream,
addr: SocketAddr,
is_websocket: bool,
) -> ResultType<Self> {
if is_websocket {
Ok(Self::WebSocket(
websocket::WsFramedStream::from(stream, addr).await,
))
} else {
Ok(Self::Tcp(tcp::FramedStream::from(stream, addr)))
}
}
/// establish connect from websocket
pub async fn connect_websocket(
@ -144,6 +127,7 @@ impl Stream {
) -> ResultType<Self> {
let ws_stream =
websocket::WsFramedStream::new(url, local_addr, proxy_conf, timeout_ms).await?;
log::debug!("WebSocket connection established");
Ok(Self::WebSocket(ws_stream))
}
@ -169,10 +153,6 @@ impl Stream {
Self::Tcp(tcp) => tcp.local_addr(),
}
}
pub fn is_websocket(&self) -> bool {
matches!(self, Self::WebSocket(_))
}
}
pub type SessionID = uuid::Uuid;