diff --git a/interface.go b/interface.go index bb825542..a9b8cdeb 100644 --- a/interface.go +++ b/interface.go @@ -256,8 +256,9 @@ type Config struct { StatelessResetKey []byte // KeepAlive defines whether this peer will periodically send a packet to keep the connection alive. KeepAlive bool - // QUIC Event Tracer. - // Warning: Experimental. This API should not be considered stable and will change soon. + // QUIC Event Tracer (see https://github.com/google/quic-trace). + // Warning: Support for quic-trace will soon be dropped in favor of qlog. + // It is disabled by default. Use the "quictrace" build tag to enable (e.g. go build -tags quictrace). QuicTracer quictrace.Tracer Tracer logging.Tracer } diff --git a/quictrace/null_tracer.go b/quictrace/null_tracer.go new file mode 100644 index 00000000..fd17af7f --- /dev/null +++ b/quictrace/null_tracer.go @@ -0,0 +1,17 @@ +// +build !quictrace + +package quictrace + +import "github.com/lucas-clemente/quic-go/internal/protocol" + +// NewTracer returns a new Tracer that doesn't do anything. +func NewTracer() Tracer { + return &nullTracer{} +} + +type nullTracer struct{} + +var _ Tracer = &nullTracer{} + +func (t *nullTracer) Trace(protocol.ConnectionID, Event) {} +func (t *nullTracer) GetAllTraces() map[string][]byte { return make(map[string][]byte) } diff --git a/quictrace/tracer.go b/quictrace/tracer.go index df963977..0f6654f4 100644 --- a/quictrace/tracer.go +++ b/quictrace/tracer.go @@ -1,3 +1,5 @@ +// +build quictrace + package quictrace import (