mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -04:00
cargo fmt
This commit is contained in:
parent
c02a83f185
commit
1d86256733
5 changed files with 28 additions and 8 deletions
|
@ -152,7 +152,12 @@ impl EpoxyUdpStream {
|
||||||
.map_err(|_| EpoxyError::InvalidPayload)?
|
.map_err(|_| EpoxyError::InvalidPayload)?
|
||||||
.0
|
.0
|
||||||
.to_vec();
|
.to_vec();
|
||||||
Ok(self.tx.lock().await.send(BytesMut::from(payload.as_slice())).await?)
|
Ok(self
|
||||||
|
.tx
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.send(BytesMut::from(payload.as_slice()))
|
||||||
|
.await?)
|
||||||
}
|
}
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,10 @@ impl EpoxyClient {
|
||||||
url.scheme().ok_or(EpoxyError::InvalidUrlScheme)?;
|
url.scheme().ok_or(EpoxyError::InvalidUrlScheme)?;
|
||||||
|
|
||||||
let host = url.host().ok_or(EpoxyError::NoUrlHost)?;
|
let host = url.host().ok_or(EpoxyError::NoUrlHost)?;
|
||||||
let port_str = url.port_u16().map(|x| format!(":{}", x)).unwrap_or_default();
|
let port_str = url
|
||||||
|
.port_u16()
|
||||||
|
.map(|x| format!(":{}", x))
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
let request_method = object_get(&options, "method")
|
let request_method = object_get(&options, "method")
|
||||||
.as_string()
|
.as_string()
|
||||||
|
@ -587,7 +590,10 @@ impl EpoxyClient {
|
||||||
}
|
}
|
||||||
headers_map.insert("Connection", HeaderValue::from_static("keep-alive"));
|
headers_map.insert("Connection", HeaderValue::from_static("keep-alive"));
|
||||||
headers_map.insert("User-Agent", HeaderValue::from_str(&self.user_agent)?);
|
headers_map.insert("User-Agent", HeaderValue::from_str(&self.user_agent)?);
|
||||||
headers_map.insert("Host", HeaderValue::from_str(&format!("{}{}", host, port_str))?);
|
headers_map.insert(
|
||||||
|
"Host",
|
||||||
|
HeaderValue::from_str(&format!("{}{}", host, port_str))?,
|
||||||
|
);
|
||||||
|
|
||||||
if let Some(content_type) = body_content_type {
|
if let Some(content_type) = body_content_type {
|
||||||
headers_map.insert("Content-Type", HeaderValue::from_str(&content_type)?);
|
headers_map.insert("Content-Type", HeaderValue::from_str(&content_type)?);
|
||||||
|
|
|
@ -10,7 +10,10 @@ use pty_process::{Pty, Size};
|
||||||
use tokio::{io::copy, process::Child, select, sync::Mutex};
|
use tokio::{io::copy, process::Child, select, sync::Mutex};
|
||||||
use tokio_util::compat::{FuturesAsyncReadCompatExt, FuturesAsyncWriteCompatExt};
|
use tokio_util::compat::{FuturesAsyncReadCompatExt, FuturesAsyncWriteCompatExt};
|
||||||
use wisp_mux::{
|
use wisp_mux::{
|
||||||
extensions::{AnyProtocolExtension, ProtocolExtension, ProtocolExtensionBuilder, AnyProtocolExtensionBuilder},
|
extensions::{
|
||||||
|
AnyProtocolExtension, AnyProtocolExtensionBuilder, ProtocolExtension,
|
||||||
|
ProtocolExtensionBuilder,
|
||||||
|
},
|
||||||
ws::{LockedWebSocketWrite, WebSocketRead},
|
ws::{LockedWebSocketWrite, WebSocketRead},
|
||||||
MuxStreamAsyncRead, MuxStreamAsyncWrite, WispError,
|
MuxStreamAsyncRead, MuxStreamAsyncWrite, WispError,
|
||||||
};
|
};
|
||||||
|
|
|
@ -228,7 +228,7 @@ pub enum ServerRouteResult {
|
||||||
|
|
||||||
impl Display for ServerRouteResult {
|
impl Display for ServerRouteResult {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Wisp(_) => write!(f, "Wisp"),
|
Self::Wisp(_) => write!(f, "Wisp"),
|
||||||
Self::WsProxy(_, path, udp) => write!(f, "WsProxy path {:?} udp {:?}", path, udp),
|
Self::WsProxy(_, path, udp) => write!(f, "WsProxy path {:?} udp {:?}", path, udp),
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub(crate) enum WsEvent {
|
||||||
SendPong(Payload<'static>),
|
SendPong(Payload<'static>),
|
||||||
WispMessage(Option<Packet<'static>>, Option<Frame<'static>>),
|
WispMessage(Option<Packet<'static>>, Option<Frame<'static>>),
|
||||||
EndFut(Option<CloseReason>),
|
EndFut(Option<CloseReason>),
|
||||||
Noop
|
Noop,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MuxMapValue {
|
struct MuxMapValue {
|
||||||
|
@ -316,10 +316,16 @@ impl<R: WebSocketRead + Send> MuxInner<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WsEvent::SendPing(payload, channel) => {
|
WsEvent::SendPing(payload, channel) => {
|
||||||
let _ = channel.send(self.tx.write_frame(Frame::new(OpCode::Ping, payload, true)).await);
|
let _ = channel.send(
|
||||||
|
self.tx
|
||||||
|
.write_frame(Frame::new(OpCode::Ping, payload, true))
|
||||||
|
.await,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
WsEvent::SendPong(payload) => {
|
WsEvent::SendPong(payload) => {
|
||||||
self.tx.write_frame(Frame::new(OpCode::Pong, payload, true)).await?;
|
self.tx
|
||||||
|
.write_frame(Frame::new(OpCode::Pong, payload, true))
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
WsEvent::EndFut(x) => {
|
WsEvent::EndFut(x) => {
|
||||||
if let Some(reason) = x {
|
if let Some(reason) = x {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue