migrate to go mod

This commit is contained in:
DeniskaRediska committed 2020-03-06 12:14:52 +03:00
1 parent 665641c88b
commit 72e6bbe6d7
45 files changed
+784 -1029

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
package websocket
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
"sync"
)
+5 -5
View File
@@ -10,7 +10,7 @@ import (
"sync"
"github.com/fasthttp/websocket"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"github.com/valyala/fasthttp"
"google.golang.org/grpc/codes"
@@ -90,9 +90,7 @@ func (p *websocketProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) dom
outgoingDialer := websocket.Dialer{
ReadBufferSize: readBufSize,
WriteBufferSize: writeBufSize,
NetDial: func(network, address string) (net.Conn, error) {
return net.Dial(network, address)
},
NetDial: net.Dial,
}
addr := addrs.Get()
@@ -114,6 +112,7 @@ func (p *websocketProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) dom
cookies.SetCookies(&url.URL{Host: reqHost, Scheme: reqScheme}, cookie)
outgoingDialer.Jar = cookies
//nolint
outgoingConn, _, err := outgoingDialer.Dial(urlAddr, header)
if err == nil {
go func() {
@@ -123,6 +122,7 @@ func (p *websocketProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) dom
} else {
log.Errorf(log_code.ErrorWebsocketProxy, "unable to connect to service %s: %v", urlAddr, err)
_ = incomingConn.Close()
_ = outgoingConn.Close()
}
})
@@ -149,7 +149,7 @@ func (p *websocketProxy) proxyConn(from, to *websocket.Conn) error {
defer func() {
_ = from.Close()
_ = to.Close()
pool.Put(buf)
pool.Put(&buf)
}()
for {
msgType, reader, err := from.NextReader()