fix
This commit is contained in:
parent
9a12aa72a0
commit
3d9640c570
14
src/relay.rs
14
src/relay.rs
@ -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;
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user