Fix linter issues
This commit is contained in:
@@ -2,18 +2,12 @@ package deconnector
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func (d *Deconnector) Handle(clientConn net.Conn) {
|
||||
upstreamURL, err := d.dialer.UpstreamURL()
|
||||
if err != nil {
|
||||
d.app.Logger().WithError(err).Error("failed to get upstream URL")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (d *Deconnector) Handle(ctx context.Context, clientConn net.Conn) {
|
||||
defer clientConn.Close()
|
||||
|
||||
req, err := http.ReadRequest(bufio.NewReader(clientConn))
|
||||
@@ -26,9 +20,9 @@ func (d *Deconnector) Handle(clientConn net.Conn) {
|
||||
if req.Method == http.MethodConnect {
|
||||
_, port, _ := net.SplitHostPort(req.Host)
|
||||
if port == "443" {
|
||||
d.handleTunnel(clientConn, req.Host, upstreamURL)
|
||||
d.handleTunnel(ctx, clientConn, req.Host)
|
||||
} else {
|
||||
d.handleDeconnect(clientConn, req, upstreamURL)
|
||||
d.handleDeconnect(ctx, clientConn, req)
|
||||
}
|
||||
} else {
|
||||
req.RequestURI = ""
|
||||
@@ -42,6 +36,6 @@ func (d *Deconnector) Handle(clientConn net.Conn) {
|
||||
WithField("url", req.URL).
|
||||
Info("Forwarding HTTP request")
|
||||
|
||||
d.forwardHTTP(clientConn, req, upstreamURL)
|
||||
d.forwardHTTP(ctx, clientConn, req)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user