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,
|
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;
|
||||||
|
|||||||
@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user