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

View File

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