fixed connection id logging length to 8
This commit is contained in:
parent
b8ea5747c8
commit
e1c54c065c
@ -10,7 +10,7 @@ use tuic_quinn::Task;
|
||||
impl Connection {
|
||||
pub(crate) async fn handle_uni_stream(self, recv: RecvStream, _reg: Register) {
|
||||
log::debug!(
|
||||
"[{id:#08x}] [{addr}] [{user}] incoming unidirectional stream",
|
||||
"[{id:#010x}] [{addr}] [{user}] incoming unidirectional stream",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -59,7 +59,7 @@ impl Connection {
|
||||
Ok(_) => unreachable!(), // already filtered in `tuic_quinn`
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] handling incoming unidirectional stream error: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] handling incoming unidirectional stream error: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -75,7 +75,7 @@ impl Connection {
|
||||
_reg: Register,
|
||||
) {
|
||||
log::debug!(
|
||||
"[{id:#08x}] [{addr}] [{user}] incoming bidirectional stream",
|
||||
"[{id:#010x}] [{addr}] [{user}] incoming bidirectional stream",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -112,7 +112,7 @@ impl Connection {
|
||||
Ok(_) => unreachable!(), // already filtered in `tuic_quinn`
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] handling incoming bidirectional stream error: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] handling incoming bidirectional stream error: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -124,7 +124,7 @@ impl Connection {
|
||||
|
||||
pub(crate) async fn handle_datagram(self, dg: Bytes) {
|
||||
log::debug!(
|
||||
"[{id:#08x}] [{addr}] [{user}] incoming datagram",
|
||||
"[{id:#010x}] [{addr}] [{user}] incoming datagram",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -153,7 +153,7 @@ impl Connection {
|
||||
Ok(_) => unreachable!(),
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] handling incoming datagram error: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] handling incoming datagram error: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
|
@ -17,7 +17,7 @@ use tuic_quinn::{Authenticate, Connect, Packet};
|
||||
impl Connection {
|
||||
pub(super) async fn handle_authenticate(&self, auth: Authenticate) {
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [authenticate] {auth_uuid}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [authenticate] {auth_uuid}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -29,7 +29,7 @@ impl Connection {
|
||||
let target_addr = conn.addr().to_string();
|
||||
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [connect] {target_addr}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [connect] {target_addr}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -71,7 +71,7 @@ impl Connection {
|
||||
match process.await {
|
||||
Ok(()) => {}
|
||||
Err(err) => log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [connect] {target_addr}: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [connect] {target_addr}: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -86,7 +86,7 @@ impl Connection {
|
||||
let frag_total = pkt.frag_total();
|
||||
|
||||
log::info!(
|
||||
"[{id:#08x}] [{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}] {frag_id}/{frag_total}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -99,7 +99,7 @@ impl Connection {
|
||||
Ok(Some(res)) => res,
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{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}] {frag_id}/{frag_total}: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -110,7 +110,7 @@ impl Connection {
|
||||
|
||||
let process = async {
|
||||
log::info!(
|
||||
"[{id:#08x}] [{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}] {src_addr}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -140,7 +140,7 @@ impl Connection {
|
||||
|
||||
if let Err(err) = process.await {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{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}] {src_addr}: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -151,7 +151,7 @@ impl Connection {
|
||||
|
||||
pub(super) async fn handle_dissociate(&self, assoc_id: u16) {
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [dissociate] [{assoc_id:#06x}]",
|
||||
"[{id:#010x}] [{addr}] [{user}] [dissociate] [{assoc_id:#06x}]",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -164,7 +164,7 @@ impl Connection {
|
||||
|
||||
pub(super) async fn handle_heartbeat(&self) {
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [heartbeat]",
|
||||
"[{id:#010x}] [{addr}] [{user}] [heartbeat]",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -175,7 +175,7 @@ impl Connection {
|
||||
let addr_display = addr.to_string();
|
||||
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
@ -190,7 +190,7 @@ impl Connection {
|
||||
|
||||
if let Err(err) = res {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}: {err}",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
|
@ -75,7 +75,7 @@ impl Connection {
|
||||
match init.await {
|
||||
Ok(conn) => {
|
||||
log::info!(
|
||||
"[{id:#08x}] [{addr}] [{user}] connection established",
|
||||
"[{id:#010x}] [{addr}] [{user}] connection established",
|
||||
id = conn.id(),
|
||||
user = conn.auth,
|
||||
);
|
||||
@ -106,13 +106,13 @@ impl Connection {
|
||||
Err(err) if err.is_locally_closed() => {}
|
||||
Err(err) if err.is_timeout_closed() => {
|
||||
log::debug!(
|
||||
"[{id:#08x}] [{addr}] [{user}] connection timeout",
|
||||
"[{id:#010x}] [{addr}] [{user}] connection timeout",
|
||||
id = conn.id(),
|
||||
user = conn.auth,
|
||||
);
|
||||
}
|
||||
Err(err) => log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] connection error: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] connection error: {err}",
|
||||
id = conn.id(),
|
||||
user = conn.auth,
|
||||
),
|
||||
@ -122,7 +122,7 @@ impl Connection {
|
||||
Err(err) if err.is_locally_closed() || err.is_timeout_closed() => unreachable!(),
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [unauthenticated] connection establishing error: {err}",
|
||||
"[{id:#010x}] [{addr}] [unauthenticated] connection establishing error: {err}",
|
||||
id = usize::MAX,
|
||||
)
|
||||
}
|
||||
@ -173,7 +173,7 @@ impl Connection {
|
||||
|
||||
if self.auth.get().is_none() {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [unauthenticated] [authenticate] timeout",
|
||||
"[{id:#010x}] [{addr}] [unauthenticated] [authenticate] timeout",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
);
|
||||
@ -190,7 +190,7 @@ impl Connection {
|
||||
}
|
||||
|
||||
log::debug!(
|
||||
"[{id:#08x}] [{addr}] [{user}] packet fragment garbage collecting event",
|
||||
"[{id:#010x}] [{addr}] [{user}] packet fragment garbage collecting event",
|
||||
id = self.id(),
|
||||
addr = self.inner.remote_address(),
|
||||
user = self.auth,
|
||||
|
@ -98,7 +98,7 @@ impl UdpSession {
|
||||
Ok(res) => res,
|
||||
Err(err) => {
|
||||
log::warn!(
|
||||
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] outbound listening error: {err}",
|
||||
"[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] outbound listening error: {err}",
|
||||
id = session_listening.0.conn.id(),
|
||||
addr = session_listening.0.conn.inner.remote_address(),
|
||||
user = session_listening.0.conn.auth,
|
||||
|
Loading…
x
Reference in New Issue
Block a user