chore: update deps.
All checks were successful
Gitea Actions Demo / build (push) Successful in 4m21s
All checks were successful
Gitea Actions Demo / build (push) Successful in 4m21s
Signed-off-by: Ivan Li <ivanli2048@gmail.com>
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -7,7 +7,11 @@ use log::{debug, error};
|
||||
use tokio::time::sleep;
|
||||
use tokio_tungstenite::{
|
||||
connect_async,
|
||||
tungstenite::{protocol::{frame::coding::CloseCode, CloseFrame}, Message},
|
||||
tungstenite::{
|
||||
client::IntoClientRequest,
|
||||
protocol::{frame::coding::CloseCode, CloseFrame},
|
||||
Message,
|
||||
},
|
||||
};
|
||||
|
||||
mod clash_conn_msg;
|
||||
@@ -79,11 +83,10 @@ async fn main() {
|
||||
}
|
||||
|
||||
async fn pipe(connect_addr: String) -> anyhow::Result<()> {
|
||||
let url = url::Url::parse(&connect_addr).map_err(|err| anyhow::anyhow!(err))?;
|
||||
|
||||
let (mut ws_stream, _) = connect_async(url)
|
||||
.await
|
||||
.map_err(|err| anyhow::anyhow!(err))?;
|
||||
let request = connect_addr.into_client_request()?;
|
||||
|
||||
let (mut ws_stream, _) = connect_async(request).await.map_err(|err| anyhow::anyhow!(err))?;
|
||||
println!("WebSocket handshake has been successfully completed");
|
||||
|
||||
while let Some(message) = ws_stream.next().await {
|
||||
@@ -102,7 +105,8 @@ async fn pipe(connect_addr: String) -> anyhow::Result<()> {
|
||||
.close(Some(CloseFrame {
|
||||
code: CloseCode::Unsupported,
|
||||
reason: "parse message failed".into(),
|
||||
})).await
|
||||
}))
|
||||
.await
|
||||
.map_err(|err| anyhow!(err))?;
|
||||
bail!(err);
|
||||
}
|
||||
|
Reference in New Issue
Block a user