Skip to content

Commit

Permalink
qlog: rename qlog.go to connection_tracer.go (quic-go#4301)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored and mgjeong committed Feb 13, 2024
1 parent d228256 commit 2b5eccf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
29 changes: 0 additions & 29 deletions qlog/qlog.go → qlog/connection_tracer.go
Expand Up @@ -6,7 +6,6 @@ import (
"io"
"log"
"net"
"runtime/debug"
"time"

"github.com/quic-go/quic-go/internal/protocol"
Expand All @@ -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 {
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions qlog/trace.go
@@ -1,6 +1,7 @@
package qlog

import (
"runtime/debug"
"time"

"github.com/quic-go/quic-go/internal/protocol"
Expand All @@ -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
}
Expand Down

0 comments on commit 2b5eccf

Please sign in to comment.