mirror of
https://github.com/1f349/violet.git
synced 2024-11-21 19:01:39 +00:00
Less logging from hybrid transport
This commit is contained in:
parent
f442409ebf
commit
ecee594219
@ -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)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user