Less logging from hybrid transport

This commit is contained in:
Melon 2024-08-28 19:49:30 +01:00
parent f442409ebf
commit ecee594219
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -4,7 +4,6 @@ import (
"crypto/tls" "crypto/tls"
"github.com/1f349/violet/logger" "github.com/1f349/violet/logger"
"github.com/1f349/violet/proxy/websocket" "github.com/1f349/violet/proxy/websocket"
"github.com/google/uuid"
"net" "net"
"net/http" "net/http"
"sync" "sync"
@ -75,24 +74,15 @@ func NewHybridTransportWithCalls(normal, insecure http.RoundTripper, ws *websock
// SecureRoundTrip calls the secure transport // SecureRoundTrip calls the secure transport
func (h *HybridTransport) SecureRoundTrip(req *http.Request) (*http.Response, error) { func (h *HybridTransport) SecureRoundTrip(req *http.Request) (*http.Response, error) {
u := uuid.New()
loggerSecure.Info("Start upgrade", "id", u)
defer loggerSecure.Info("Stop upgrade", "id", u)
return h.normalTransport.RoundTrip(req) return h.normalTransport.RoundTrip(req)
} }
// InsecureRoundTrip calls the insecure transport // InsecureRoundTrip calls the insecure transport
func (h *HybridTransport) InsecureRoundTrip(req *http.Request) (*http.Response, error) { func (h *HybridTransport) InsecureRoundTrip(req *http.Request) (*http.Response, error) {
u := uuid.New()
loggerInsecure.Info("Start upgrade", "id", u)
defer loggerInsecure.Info("Stop upgrade", "id", u)
return h.insecureTransport.RoundTrip(req) return h.insecureTransport.RoundTrip(req)
} }
// ConnectWebsocket calls the websocket upgrader and thus hijacks the connection // ConnectWebsocket calls the websocket upgrader and thus hijacks the connection
func (h *HybridTransport) ConnectWebsocket(rw http.ResponseWriter, req *http.Request) { func (h *HybridTransport) ConnectWebsocket(rw http.ResponseWriter, req *http.Request) {
u := uuid.New()
loggerWebsocket.Info("Start upgrade", "id", u)
h.ws.Upgrade(rw, req) h.ws.Upgrade(rw, req)
loggerWebsocket.Info("Stop upgrade", "id", u)
} }