better packet infomation logging
This commit is contained in:
parent
ae052a805b
commit
d6e4e7eeee
@ -39,11 +39,11 @@ impl Connection {
|
|||||||
|
|
||||||
match self.udp_relay_mode {
|
match self.udp_relay_mode {
|
||||||
UdpRelayMode::Native => {
|
UdpRelayMode::Native => {
|
||||||
log::info!("[relay] [packet] [{assoc_id:#06x}] [to-native] {addr_display}");
|
log::info!("[relay] [packet] [{assoc_id:#06x}] [to-native] to {addr_display}");
|
||||||
match self.model.packet_native(pkt, addr, assoc_id) {
|
match self.model.packet_native(pkt, addr, assoc_id) {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("[relay] [packet] [{assoc_id:#06x}] [to-native] failed relaying packet to {addr_display}: {err}");
|
log::warn!("[relay] [packet] [{assoc_id:#06x}] [to-native] to {addr_display}: {err}");
|
||||||
Err(Error::Model(err))
|
Err(Error::Model(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,9 @@ impl Connection {
|
|||||||
match self.model.packet_quic(pkt, addr, assoc_id).await {
|
match self.model.packet_quic(pkt, addr, assoc_id).await {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("[relay] [packet] [{assoc_id:#06x}] [to-quic] failed relaying packet to {addr_display}: {err}");
|
log::warn!(
|
||||||
|
"[relay] [packet] [{assoc_id:#06x}] [to-quic] to {addr_display}: {err}"
|
||||||
|
);
|
||||||
Err(Error::Model(err))
|
Err(Error::Model(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +68,7 @@ impl Connection {
|
|||||||
match self.model.dissociate(assoc_id).await {
|
match self.model.dissociate(assoc_id).await {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("[relay] [dissociate] [{assoc_id:#06x}] failed dissociating: {err}");
|
log::warn!("[relay] [dissociate] [{assoc_id:#06x}] {err}");
|
||||||
Err(Error::Model(err))
|
Err(Error::Model(err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +88,7 @@ impl Connection {
|
|||||||
|
|
||||||
match self.model.heartbeat().await {
|
match self.model.heartbeat().await {
|
||||||
Ok(()) => log::debug!("[relay] [heartbeat]"),
|
Ok(()) => log::debug!("[relay] [heartbeat]"),
|
||||||
Err(err) => log::warn!("[relay] [heartbeat] heartbeat sending error: {err}"),
|
Err(err) => log::warn!("[relay] [heartbeat] {err}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +107,7 @@ impl Connection {
|
|||||||
|
|
||||||
match pkt.accept().await {
|
match pkt.accept().await {
|
||||||
Ok(Some((pkt, addr, _))) => {
|
Ok(Some((pkt, addr, _))) => {
|
||||||
log::info!("[relay] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {addr}");
|
log::info!("[relay] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] from {addr}");
|
||||||
|
|
||||||
let addr = match addr {
|
let addr = match addr {
|
||||||
Address::None => unreachable!(),
|
Address::None => unreachable!(),
|
||||||
|
@ -86,7 +86,7 @@ impl Connection {
|
|||||||
let frag_total = pkt.frag_total();
|
let frag_total = pkt.frag_total();
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] fragment {frag_id}/{frag_total}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
@ -99,7 +99,7 @@ impl Connection {
|
|||||||
Ok(Some(res)) => res,
|
Ok(Some(res)) => res,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}: {err}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] fragment {frag_id}/{frag_total}: {err}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
@ -110,7 +110,7 @@ impl Connection {
|
|||||||
|
|
||||||
let process = async {
|
let process = async {
|
||||||
log::info!(
|
log::info!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] to {src_addr}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
@ -140,7 +140,7 @@ impl Connection {
|
|||||||
|
|
||||||
if let Err(err) = process.await {
|
if let Err(err) = process.await {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}: {err}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] to {src_addr}: {err}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
@ -175,12 +175,12 @@ impl Connection {
|
|||||||
let addr_display = addr.to_string();
|
let addr_display = addr.to_string();
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] from {src_addr}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
mode = self.udp_relay_mode.load().unwrap(),
|
mode = self.udp_relay_mode.load().unwrap(),
|
||||||
target_addr = addr_display,
|
src_addr = addr_display,
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = match self.udp_relay_mode.load().unwrap() {
|
let res = match self.udp_relay_mode.load().unwrap() {
|
||||||
@ -190,12 +190,12 @@ impl Connection {
|
|||||||
|
|
||||||
if let Err(err) = res {
|
if let Err(err) = res {
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}: {err}",
|
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] from {src_addr}: {err}",
|
||||||
id = self.id(),
|
id = self.id(),
|
||||||
addr = self.inner.remote_address(),
|
addr = self.inner.remote_address(),
|
||||||
user = self.auth,
|
user = self.auth,
|
||||||
mode = self.udp_relay_mode.load().unwrap(),
|
mode = self.udp_relay_mode.load().unwrap(),
|
||||||
target_addr = addr_display,
|
src_addr = addr_display,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user