diff --git a/backend/backend_quicgo.go b/backend/backend_quicgo.go index 79c2c3c..e98b7c7 100644 --- a/backend/backend_quicgo.go +++ b/backend/backend_quicgo.go @@ -16,7 +16,7 @@ import ( "fmt" "github.com/Project-Faster/quic-go" "github.com/Project-Faster/quic-go/logging" - errors2 "github.com/parvit/qpep/shared/errors" + stderr "github.com/parvit/qpep/shared/errors" "github.com/parvit/qpep/shared/logger" "github.com/parvit/qpep/workers/gateway" "io/ioutil" @@ -53,7 +53,7 @@ func (q *quicGoBackend) Dial(ctx context.Context, remoteAddress string, port int session, err = quic.DialAddr(gatewayPath, tlsConf, quicConfig) if err != nil { logger.Error("Unable to Dial Protocol Session: %v\n", err) - return nil, errors2.ErrFailedGatewayConnect + return nil, stderr.ErrFailedGatewayConnect } sessionAdapter := &qgoConnectionAdapter{ @@ -73,7 +73,7 @@ func (q *quicGoBackend) Listen(ctx context.Context, address string, port int, se conn, err := quic.ListenAddr(fmt.Sprintf("%s:%d", address, port), tlsConf, quicConfig) if err != nil { logger.Error("Failed to listen on Protocol session: %v\n", err) - return nil, errors2.ErrFailedGatewayConnect + return nil, stderr.ErrFailedGatewayConnect } return &qgoConnectionAdapter{ @@ -126,7 +126,7 @@ func (c *qgoConnectionAdapter) LocalAddr() net.Addr { if c.listener != nil { return c.listener.Addr() } - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *qgoConnectionAdapter) RemoteAddr() net.Addr { @@ -136,7 +136,7 @@ func (c *qgoConnectionAdapter) RemoteAddr() net.Addr { if c.listener != nil { return c.listener.Addr() } - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *qgoConnectionAdapter) AcceptConnection(ctx context.Context) (QuicBackendConnection, error) { @@ -153,7 +153,7 @@ func (c *qgoConnectionAdapter) AcceptConnection(ctx context.Context) (QuicBacken } return cNew, nil } - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *qgoConnectionAdapter) AcceptStream(ctx context.Context) (QuicBackendStream, error) { @@ -166,7 +166,7 @@ func (c *qgoConnectionAdapter) AcceptStream(ctx context.Context) (QuicBackendStr Stream: stream, }, err } - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *qgoConnectionAdapter) OpenStream(ctx context.Context) (QuicBackendStream, error) { @@ -176,7 +176,7 @@ func (c *qgoConnectionAdapter) OpenStream(ctx context.Context) (QuicBackendStrea Stream: stream, }, err } - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *qgoConnectionAdapter) Close(code int, message string) error { diff --git a/backend/backend_quiclygo.go b/backend/backend_quiclygo.go index 00e34dd..4675df7 100644 --- a/backend/backend_quiclygo.go +++ b/backend/backend_quiclygo.go @@ -7,7 +7,7 @@ import ( "github.com/Project-Faster/quicly-go" "github.com/Project-Faster/quicly-go/quiclylib/errors" "github.com/Project-Faster/quicly-go/quiclylib/types" - errors2 "github.com/parvit/qpep/shared/errors" + stderr "github.com/parvit/qpep/shared/errors" "github.com/parvit/qpep/shared/logger" "net" "os" @@ -80,7 +80,7 @@ func (q *quiclyGoBackend) init(isClient, traceOn bool, certPath, certKeyPath, cc } if err := quicly.Initialize(quicConfig); err != errors.QUICLY_OK { - return errors2.ErrFailed + return stderr.ErrFailed } q.initialized = true @@ -131,7 +131,7 @@ func (q *quiclyGoBackend) Dial(ctx context.Context, remoteAddress string, port i if session == nil { logger.Error("Unable to Dial Protocol Session\n") q.opLock.Unlock() - return nil, errors2.ErrFailedGatewayConnect + return nil, stderr.ErrFailedGatewayConnect } sessionAdapter := &cliConnectionAdapter{ @@ -186,7 +186,7 @@ func (q *quiclyGoBackend) Listen(ctx context.Context, address string, port int, func (q *quiclyGoBackend) Close() error { if !q.initialized { logger.Error("Protocol was not initialized") - return errors2.ErrFailed + return stderr.ErrFailed } q.opLock.Lock() defer q.opLock.Unlock() @@ -232,15 +232,15 @@ func (c *srvListenerAdapter) AcceptConnection(ctx context.Context) (QuicBackendC connection: conn, }, nil } - return nil, errors2.ErrInvalidBackendOperation + return nil, stderr.ErrInvalidBackendOperation } func (c *srvListenerAdapter) AcceptStream(ctx context.Context) (QuicBackendStream, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *srvListenerAdapter) OpenStream(ctx context.Context) (QuicBackendStream, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *srvListenerAdapter) Close(code int, message string) error { @@ -280,7 +280,7 @@ func (c *srvConnectionAdapter) RemoteAddr() net.Addr { } func (c *srvConnectionAdapter) AcceptConnection(ctx context.Context) (QuicBackendConnection, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *srvConnectionAdapter) AcceptStream(ctx context.Context) (QuicBackendStream, error) { @@ -295,11 +295,11 @@ func (c *srvConnectionAdapter) AcceptStream(ctx context.Context) (QuicBackendStr id: stream.ID(), }, err } - return nil, errors2.ErrInvalidBackendOperation + return nil, stderr.ErrInvalidBackendOperation } func (c *srvConnectionAdapter) OpenStream(ctx context.Context) (QuicBackendStream, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *srvConnectionAdapter) Close(code int, message string) error { @@ -341,11 +341,11 @@ func (c *cliConnectionAdapter) RemoteAddr() net.Addr { } func (c *cliConnectionAdapter) AcceptStream(ctx context.Context) (QuicBackendStream, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *cliConnectionAdapter) AcceptConnection(ctx context.Context) (QuicBackendConnection, error) { - panic(errors2.ErrInvalidBackendOperation) + panic(stderr.ErrInvalidBackendOperation) } func (c *cliConnectionAdapter) Close(code int, message string) error { @@ -362,7 +362,7 @@ func (c *cliConnectionAdapter) OpenStream(ctx context.Context) (QuicBackendStrea if c.connection != nil { stream := c.connection.OpenStream() if stream == nil { - return nil, errors2.ErrFailed + return nil, stderr.ErrFailed } return &streamAdapter{ @@ -371,7 +371,7 @@ func (c *cliConnectionAdapter) OpenStream(ctx context.Context) (QuicBackendStrea id: stream.ID(), }, nil } - return nil, errors2.ErrFailed + return nil, stderr.ErrFailed } func (c *cliConnectionAdapter) IsClosed() bool {