qlog: rename qlog.go to connection_tracer.go (#4301)

This commit is contained in:
Marten Seemann
2024-02-02 16:45:51 +07:00
committed by GitHub
parent f3c4be6b01
commit 0344401de5
3 changed files with 29 additions and 29 deletions

View File

@@ -6,7 +6,6 @@ import (
"io"
"log"
"net"
"runtime/debug"
"time"
"github.com/quic-go/quic-go/internal/protocol"
@@ -17,34 +16,6 @@ import (
"github.com/francoispqt/gojay"
)
// Setting of this only works when quic-go is used as a library.
// When building a binary from this repository, the version can be set using the following go build flag:
// -ldflags="-X github.com/quic-go/quic-go/qlog.quicGoVersion=foobar"
var quicGoVersion = "(devel)"
func init() {
if quicGoVersion != "(devel)" { // variable set by ldflags
return
}
info, ok := debug.ReadBuildInfo()
if !ok { // no build info available. This happens when quic-go is not used as a library.
return
}
for _, d := range info.Deps {
if d.Path == "github.com/quic-go/quic-go" {
quicGoVersion = d.Version
if d.Replace != nil {
if len(d.Replace.Version) > 0 {
quicGoVersion = d.Version
} else {
quicGoVersion += " (replaced)"
}
}
break
}
}
}
const eventChanSize = 50
type connectionTracer struct {

View File

@@ -1,6 +1,7 @@
package qlog
import (
"runtime/debug"
"time"
"github.com/quic-go/quic-go/internal/protocol"
@@ -9,6 +10,34 @@ import (
"github.com/francoispqt/gojay"
)
// Setting of this only works when quic-go is used as a library.
// When building a binary from this repository, the version can be set using the following go build flag:
// -ldflags="-X github.com/quic-go/quic-go/qlog.quicGoVersion=foobar"
var quicGoVersion = "(devel)"
func init() {
if quicGoVersion != "(devel)" { // variable set by ldflags
return
}
info, ok := debug.ReadBuildInfo()
if !ok { // no build info available. This happens when quic-go is not used as a library.
return
}
for _, d := range info.Deps {
if d.Path == "github.com/quic-go/quic-go" {
quicGoVersion = d.Version
if d.Replace != nil {
if len(d.Replace.Version) > 0 {
quicGoVersion = d.Version
} else {
quicGoVersion += " (replaced)"
}
}
break
}
}
}
type topLevel struct {
trace trace
}