mirror of
https://github.com/rustdesk/hbb_common.git
synced 2025-07-01 07:25:53 +00:00
commit
3afaf64944
@ -1,6 +1,7 @@
|
||||
use crate::{config, tcp, websocket, ResultType};
|
||||
use sodiumoxide::crypto::secretbox::Key;
|
||||
use std::net::SocketAddr;
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
// support Websocket and tcp.
|
||||
pub enum Stream {
|
||||
@ -107,4 +108,9 @@ impl Stream {
|
||||
Self::Tcp(tcp) => tcp.local_addr(),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from(stream: TcpStream, stream_addr: SocketAddr) -> Self {
|
||||
Self::Tcp(tcp::FramedStream::from(stream, stream_addr))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user