mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 05:07:36 +03:00
remove support for quic-trace
This commit is contained in:
parent
6148ea9a46
commit
02b700804f
21 changed files with 19 additions and 2372 deletions
|
@ -24,7 +24,6 @@ import (
|
|||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
"github.com/lucas-clemente/quic-go/logging"
|
||||
"github.com/lucas-clemente/quic-go/qlog"
|
||||
"github.com/lucas-clemente/quic-go/quictrace"
|
||||
)
|
||||
|
||||
type binds []string
|
||||
|
@ -54,45 +53,7 @@ func generatePRData(l int) []byte {
|
|||
return res
|
||||
}
|
||||
|
||||
var tracer quictrace.Tracer
|
||||
|
||||
func init() {
|
||||
tracer = quictrace.NewTracer()
|
||||
}
|
||||
|
||||
func exportTraces() error {
|
||||
traces := tracer.GetAllTraces()
|
||||
if len(traces) != 1 {
|
||||
return errors.New("expected exactly one trace")
|
||||
}
|
||||
for _, trace := range traces {
|
||||
f, err := os.Create("trace.qtr")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := f.Write(trace); err != nil {
|
||||
return err
|
||||
}
|
||||
f.Close()
|
||||
fmt.Println("Wrote trace to", f.Name())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type tracingHandler struct {
|
||||
handler http.Handler
|
||||
}
|
||||
|
||||
var _ http.Handler = &tracingHandler{}
|
||||
|
||||
func (h *tracingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
h.handler.ServeHTTP(w, r)
|
||||
if err := exportTraces(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func setupHandler(www string, trace bool) http.Handler {
|
||||
func setupHandler(www string) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
if len(www) > 0 {
|
||||
|
@ -170,10 +131,7 @@ func setupHandler(www string, trace bool) http.Handler {
|
|||
</form></body></html>`)
|
||||
})
|
||||
|
||||
if !trace {
|
||||
return mux
|
||||
}
|
||||
return &tracingHandler{handler: mux}
|
||||
return mux
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -188,7 +146,6 @@ func main() {
|
|||
flag.Var(&bs, "bind", "bind to")
|
||||
www := flag.String("www", "", "www data")
|
||||
tcp := flag.Bool("tcp", false, "also listen on TCP")
|
||||
trace := flag.Bool("trace", false, "enable quic-trace")
|
||||
enableQlog := flag.Bool("qlog", false, "output a qlog (in the same directory)")
|
||||
flag.Parse()
|
||||
|
||||
|
@ -205,11 +162,8 @@ func main() {
|
|||
bs = binds{"localhost:6121"}
|
||||
}
|
||||
|
||||
handler := setupHandler(*www, *trace)
|
||||
handler := setupHandler(*www)
|
||||
quicConf := &quic.Config{}
|
||||
if *trace {
|
||||
quicConf.QuicTracer = tracer
|
||||
}
|
||||
if *enableQlog {
|
||||
quicConf.Tracer = qlog.NewTracer(func(_ logging.Perspective, connID []byte) io.WriteCloser {
|
||||
filename := fmt.Sprintf("server_%x.qlog", connID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue