mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
add a logging.NullTracer
This commit is contained in:
parent
118a7dba5a
commit
48779d053f
2 changed files with 18 additions and 6 deletions
|
@ -12,7 +12,7 @@ coverage:
|
||||||
- internal/utils/newconnectionid_linkedlist.go
|
- internal/utils/newconnectionid_linkedlist.go
|
||||||
- internal/utils/packetinterval_linkedlist.go
|
- internal/utils/packetinterval_linkedlist.go
|
||||||
- internal/utils/linkedlist/linkedlist.go
|
- internal/utils/linkedlist/linkedlist.go
|
||||||
- logging/null_connection_tracer.go
|
- logging/null_tracer.go
|
||||||
- fuzzing/
|
- fuzzing/
|
||||||
- metrics/
|
- metrics/
|
||||||
status:
|
status:
|
||||||
|
|
|
@ -1,18 +1,30 @@
|
||||||
package logging
|
package logging
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The NullConnectionTracer is a ConnectionTracer that does nothing.
|
var (
|
||||||
// It is useful for embedding. Don't modify this variable!
|
// The NullTracer is a Tracer that does nothing.
|
||||||
var NullConnectionTracer ConnectionTracer = &nullConnectionTracer{}
|
// It is useful for embedding. Don't modify this variable!
|
||||||
|
NullTracer Tracer = &nullTracer{}
|
||||||
|
// The NullConnectionTracer is a ConnectionTracer that does nothing.
|
||||||
|
// It is useful for embedding. Don't modify this variable!
|
||||||
|
NullConnectionTracer ConnectionTracer = &nullConnectionTracer{}
|
||||||
|
)
|
||||||
|
|
||||||
|
type nullTracer struct{}
|
||||||
|
|
||||||
|
func (n nullTracer) TracerForConnection(context.Context, Perspective, ConnectionID) ConnectionTracer {
|
||||||
|
return NullConnectionTracer
|
||||||
|
}
|
||||||
|
func (n nullTracer) SentPacket(net.Addr, *Header, ByteCount, []Frame) {}
|
||||||
|
func (n nullTracer) DroppedPacket(net.Addr, PacketType, ByteCount, PacketDropReason) {}
|
||||||
|
|
||||||
type nullConnectionTracer struct{}
|
type nullConnectionTracer struct{}
|
||||||
|
|
||||||
var _ ConnectionTracer = &nullConnectionTracer{}
|
|
||||||
|
|
||||||
func (n nullConnectionTracer) StartedConnection(local, remote net.Addr, srcConnID, destConnID ConnectionID) {
|
func (n nullConnectionTracer) StartedConnection(local, remote net.Addr, srcConnID, destConnID ConnectionID) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue