feat: add live traffic stats (#530) (#616)

This commit is contained in:
h44z
2026-01-26 22:24:10 +01:00
committed by GitHub
parent e53b8c8087
commit 70cc44cc4d
13 changed files with 289 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
package logging
import (
"bufio"
"net"
"net/http"
)
@@ -38,6 +40,12 @@ func (w *writerWrapper) Write(data []byte) (int, error) {
return n, err
}
// Hijack wraps the Hijack method of the ResponseWriter and returns the hijacked connection.
// This is required for websockets to work.
func (w *writerWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return http.NewResponseController(w.ResponseWriter).Hijack()
}
// newWriterWrapper returns a new writerWrapper that wraps the given http.ResponseWriter.
// It initializes the StatusCode to http.StatusOK.
func newWriterWrapper(w http.ResponseWriter) *writerWrapper {