Improve sniffer

This commit is contained in:
世界
2025-04-04 16:21:50 +08:00
parent 3adc10a797
commit af17eaa537
12 changed files with 65 additions and 50 deletions
+3 -2
View File
@@ -549,7 +549,7 @@ func (r *Router) actionSniff(
sniffBuffer.Release()
}
} else if inputPacketConn != nil {
if metadata.PacketSniffError != nil && !errors.Is(metadata.PacketSniffError, sniff.ErrClientHelloFragmented) {
if metadata.PacketSniffError != nil && !errors.Is(metadata.PacketSniffError, sniff.ErrNeedMoreData) {
r.logger.DebugContext(ctx, "packet sniff skipped due to previous error: ", metadata.PacketSniffError)
return
}
@@ -618,7 +618,8 @@ func (r *Router) actionSniff(
}
packetBuffers = append(packetBuffers, packetBuffer)
metadata.PacketSniffError = err
if errors.Is(err, sniff.ErrClientHelloFragmented) {
if errors.Is(err, sniff.ErrNeedMoreData) {
// TODO: replace with generic message when there are more multi-packet protocols
r.logger.DebugContext(ctx, "attempt to sniff fragmented QUIC client hello")
continue
}