Skip to content

Commit

Permalink
upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Dec 15, 2024
1 parent 49da343 commit c38f64b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ rust-version = "1.80"
[lib]
crate-type = ["staticlib", "cdylib", "lib"]

[[bin]]
name = "overtls-bin"
path = "src/bin/main.rs"

[dependencies]
async-shared-timeout = "0.2"
base64 = "0.22"
Expand Down Expand Up @@ -47,15 +43,17 @@ rustls-pemfile = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
socket2 = "0.5"
socks5-impl = "0.5"
socks5-impl = { version = "0.6", default-features = false, features = [
"server",
] }
thiserror = "2"
tokio = { version = "1", features = ["full"] }
tokio-rustls = { version = "0.26", default-features = false, features = [
"logging",
"tls12",
"ring",
] }
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-webpki-roots"] }
tokio-tungstenite = { version = "0.25", features = ["rustls-tls-webpki-roots"] }
tokio-util = "0.7"
url = "2"
webpki = { package = "rustls-webpki", version = "0.102", features = [
Expand All @@ -64,6 +62,10 @@ webpki = { package = "rustls-webpki", version = "0.102", features = [
] }
webpki-roots = "0.26"

[[bin]]
name = "overtls-bin"
path = "src/bin/main.rs"

[target.'cfg(unix)'.dependencies]
daemonize = "0.5"

Expand Down
6 changes: 3 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async fn client_traffic_loop<T: AsyncRead + AsyncWrite + Unpin, S: AsyncRead + A
ws_stream.send(Message::Close(None)).await?;
break;
}
ws_stream.send(Message::Binary(buf.to_vec())).await?;
ws_stream.send(Message::binary(buf.to_vec())).await?;
log::trace!("{} -> {} length {}", peer_addr, target_addr, buf.len());

if let Err(e) = crate::traffic_status::traffic_status_update(len, 0) {
Expand All @@ -198,7 +198,7 @@ async fn client_traffic_loop<T: AsyncRead + AsyncWrite + Unpin, S: AsyncRead + A

match msg {
Message::Binary(data) => {
incoming.write_all(&data).await?;
incoming.write_all(data.as_slice()).await?;
log::trace!("{} <- {} length {}", peer_addr, target_addr, data.len());
}
Message::Close(_) => {
Expand All @@ -212,7 +212,7 @@ async fn client_traffic_loop<T: AsyncRead + AsyncWrite + Unpin, S: AsyncRead + A
}
}
_ = timer.tick() => {
ws_stream.send(Message::Ping(vec![])).await?;
ws_stream.send(Message::Ping(vec![].into())).await?;
log::trace!("{} -> {} Websocket ping from local", peer_addr, target_addr);
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ async fn normal_tunnel<S: AsyncRead + AsyncWrite + Unpin>(
break;
}
Message::Text(_) | Message::Binary(_) => {
outgoing.write_all(&msg.into_data()).await?;
outgoing.write_all(msg.into_data().as_slice()).await?;
}
_ => {}
}
Expand All @@ -364,7 +364,7 @@ async fn normal_tunnel<S: AsyncRead + AsyncWrite + Unpin>(
break;
}
Ok(n) => {
let msg = Message::Binary(buffer[..n].to_vec());
let msg = Message::binary(buffer[..n].to_vec());
let len = (msg.len() + WS_MSG_HEADER_LEN) as u64;
log::trace!("{peer} <- {dst_addr} length {}", len);
if let Some(client_id) = &client_id {
Expand Down Expand Up @@ -410,8 +410,7 @@ async fn create_udp_tunnel<S: AsyncRead + AsyncWrite + Unpin>(
break;
}
if msg.is_text() || msg.is_binary() {
let data = msg.into_data();
let mut buf = BytesMut::from(&data[..]);
let mut buf = BytesMut::from(&msg.into_data().as_mut_slice()[..]);
let dst_addr = Address::try_from(&buf[..])?;
let _ = buf.split_to(dst_addr.len());
let src_addr = Address::try_from(&buf[..])?;
Expand Down
6 changes: 3 additions & 3 deletions src/udprelay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async fn _run_udp_loop<S: AsyncRead + AsyncWrite + Unpin>(
} else {
log::debug!("[UDP] {src_addr} -> {dst_addr} send to remote size {}", buf.len());
}
let msg = Message::Binary(buf.freeze().to_vec());
let msg = Message::binary(buf.freeze().to_vec());
ws_stream.send(msg).await?;
} else {
// log::trace!("[UDP] {dst_addr} <- {src_addr} skip feedback packet");
Expand All @@ -212,7 +212,7 @@ async fn _run_udp_loop<S: AsyncRead + AsyncWrite + Unpin>(

match msg {
Some(Ok(Message::Binary(buf))) => {
let mut buf = BytesMut::from(&buf[..]);
let mut buf = BytesMut::from(buf.as_slice());
let incoming_addr = Address::try_from(&buf[..])?;
let _ = buf.split_to(incoming_addr.len());
let remote_addr = Address::try_from(&buf[..])?;
Expand Down Expand Up @@ -256,7 +256,7 @@ async fn _run_udp_loop<S: AsyncRead + AsyncWrite + Unpin>(
Ok::<_, Error>(())
},
_ = timer.tick() => {
ws_stream.send(Message::Ping(vec![])).await?;
ws_stream.send(Message::Ping(vec![].into())).await?;
log::trace!("[UDP] Websocket ping from local");
Ok::<_, Error>(())
}
Expand Down

0 comments on commit c38f64b

Please sign in to comment.