This commit is contained in:
anlicheng 2026-07-03 18:09:07 +08:00
parent 9a12aa72a0
commit 3d9640c570
2 changed files with 14 additions and 1 deletions

View File

@ -7,7 +7,7 @@ use tokio::{
net::TcpStream,
time::timeout,
};
use tracing::{debug, warn};
use tracing::{debug, info, warn};
use crate::{
auth::Authenticator,
@ -36,6 +36,12 @@ pub async fn handle_stream(
return;
}
};
info!(
%remote,
host = %request.host,
port = request.port,
"open request received"
);
if !context.authenticator.authenticate(&request) {
warn!(%remote, host = %request.host, port = request.port, "authentication failed");
@ -46,6 +52,12 @@ pub async fn handle_stream(
match open_tcp(&request, context.connect_timeout).await {
Ok(tcp) => {
info!(
%remote,
host = %request.host,
port = request.port,
"target tcp connection opened"
);
if let Err(err) = protocol::write_open_ack(&mut send).await {
warn!(%remote, error = %err, "failed to write open ack");
return;

View File

@ -72,6 +72,7 @@ async fn handle_connection(
loop {
match connection.accept_bi().await {
Ok((send, recv)) => {
info!(%remote, "quic bidirectional stream accepted");
let context = context.clone();
tokio::spawn(relay::handle_stream(remote, send, recv, context));
}