proxy

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package proxy is a generated GoMock package.

Package proxy is a generated GoMock package.

Package proxy is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Perform added in v0.6.13

func Perform(ctx *fasthttp.RequestCtx, proxyPool Pool) error

Perform function proxies the request to the backend server

Types

type FastHTTPWebSocketClient added in v0.6.13

type FastHTTPWebSocketClient struct {
	Dialer  *websocket.Dialer
	ConnStr string
	Logger  *logrus.Logger
}

FastHTTPWebSocketClient implements the WebSocketClient interface

func (*FastHTTPWebSocketClient) GetConn added in v0.6.13

type FastHTTPWebSocketConn added in v0.6.13

type FastHTTPWebSocketConn struct {
	Conn   *websocket.Conn
	Logger *logrus.Logger
	Ctx    *fasthttp.RequestCtx
	// contains filtered or unexported fields
}

FastHTTPWebSocketConn implements the WebSocketConn interface

func (*FastHTTPWebSocketConn) Close added in v0.6.13

func (f *FastHTTPWebSocketConn) Close() error

func (*FastHTTPWebSocketConn) ReadMessage added in v0.6.13

func (f *FastHTTPWebSocketConn) ReadMessage() (messageType int, p []byte, err error)

func (*FastHTTPWebSocketConn) SendCloseConnection added in v0.6.13

func (f *FastHTTPWebSocketConn) SendCloseConnection(closeType int) error

func (*FastHTTPWebSocketConn) SendComplete added in v0.6.13

func (f *FastHTTPWebSocketConn) SendComplete(messageType int, id string) error

func (*FastHTTPWebSocketConn) SendError added in v0.6.13

func (f *FastHTTPWebSocketConn) SendError(messageType int, msgID string, requestErrors error) error

func (*FastHTTPWebSocketConn) WriteMessage added in v0.6.13

func (f *FastHTTPWebSocketConn) WriteMessage(messageType int, data []byte) error

type GqlWSErrorMessage added in v0.6.13

type GqlWSErrorMessage struct {
	ID      string                `json:"id"`
	Type    string                `json:"type"`
	Payload graphql.RequestErrors `json:"payload,omitempty"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *fasthttp.Request, resp *fasthttp.Response) error
}

type MockHTTPClient added in v0.6.9

type MockHTTPClient struct {
	// contains filtered or unexported fields
}

MockHTTPClient is a mock of HTTPClient interface.

func NewMockHTTPClient added in v0.6.9

func NewMockHTTPClient(ctrl *gomock.Controller) *MockHTTPClient

NewMockHTTPClient creates a new mock instance.

func (*MockHTTPClient) Do added in v0.6.9

Do mocks base method.

func (*MockHTTPClient) EXPECT added in v0.6.9

EXPECT returns an object that allows the caller to indicate expected use.

type MockHTTPClientMockRecorder added in v0.6.9

type MockHTTPClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockHTTPClientMockRecorder is the mock recorder for MockHTTPClient.

func (*MockHTTPClientMockRecorder) Do added in v0.6.9

func (mr *MockHTTPClientMockRecorder) Do(req, resp interface{}) *gomock.Call

Do indicates an expected call of Do.

type MockPool added in v0.6.9

type MockPool struct {
	// contains filtered or unexported fields
}

MockPool is a mock of Pool interface.

func NewMockPool added in v0.6.9

func NewMockPool(ctrl *gomock.Controller) *MockPool

NewMockPool creates a new mock instance.

func (*MockPool) Close added in v0.6.9

func (m *MockPool) Close()

Close mocks base method.

func (*MockPool) EXPECT added in v0.6.9

func (m *MockPool) EXPECT() *MockPoolMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPool) Get added in v0.6.9

func (m *MockPool) Get() (HTTPClient, error)

Get mocks base method.

func (*MockPool) Len added in v0.6.9

func (m *MockPool) Len() int

Len mocks base method.

func (*MockPool) Put added in v0.6.9

func (m *MockPool) Put(arg0 HTTPClient) error

Put mocks base method.

type MockPoolMockRecorder added in v0.6.9

type MockPoolMockRecorder struct {
	// contains filtered or unexported fields
}

MockPoolMockRecorder is the mock recorder for MockPool.

func (*MockPoolMockRecorder) Close added in v0.6.9

func (mr *MockPoolMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockPoolMockRecorder) Get added in v0.6.9

func (mr *MockPoolMockRecorder) Get() *gomock.Call

Get indicates an expected call of Get.

func (*MockPoolMockRecorder) Len added in v0.6.9

func (mr *MockPoolMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len.

func (*MockPoolMockRecorder) Put added in v0.6.9

func (mr *MockPoolMockRecorder) Put(arg0 interface{}) *gomock.Call

Put indicates an expected call of Put.

type MockWebSocketClient added in v0.6.13

type MockWebSocketClient struct {
	// contains filtered or unexported fields
}

MockWebSocketClient is a mock of WebSocketClient interface.

func NewMockWebSocketClient added in v0.6.13

func NewMockWebSocketClient(ctrl *gomock.Controller) *MockWebSocketClient

NewMockWebSocketClient creates a new mock instance.

func (*MockWebSocketClient) EXPECT added in v0.6.13

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockWebSocketClient) GetConn added in v0.6.13

GetConn mocks base method.

type MockWebSocketClientMockRecorder added in v0.6.13

type MockWebSocketClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockWebSocketClientMockRecorder is the mock recorder for MockWebSocketClient.

func (*MockWebSocketClientMockRecorder) GetConn added in v0.6.13

func (mr *MockWebSocketClientMockRecorder) GetConn(ctx interface{}) *gomock.Call

GetConn indicates an expected call of GetConn.

type MockWebSocketConn added in v0.6.13

type MockWebSocketConn struct {
	// contains filtered or unexported fields
}

MockWebSocketConn is a mock of WebSocketConn interface.

func NewMockWebSocketConn added in v0.6.13

func NewMockWebSocketConn(ctrl *gomock.Controller) *MockWebSocketConn

NewMockWebSocketConn creates a new mock instance.

func (*MockWebSocketConn) Close added in v0.6.13

func (m *MockWebSocketConn) Close() error

Close mocks base method.

func (*MockWebSocketConn) EXPECT added in v0.6.13

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockWebSocketConn) ReadMessage added in v0.6.13

func (m *MockWebSocketConn) ReadMessage() (int, []byte, error)

ReadMessage mocks base method.

func (*MockWebSocketConn) SendCloseConnection added in v0.6.13

func (m *MockWebSocketConn) SendCloseConnection(closeType int) error

SendCloseConnection mocks base method.

func (*MockWebSocketConn) SendComplete added in v0.6.13

func (m *MockWebSocketConn) SendComplete(messageType int, id string) error

SendComplete mocks base method.

func (*MockWebSocketConn) SendError added in v0.6.13

func (m *MockWebSocketConn) SendError(messageType int, msgID string, requestErrors error) error

SendError mocks base method.

func (*MockWebSocketConn) WriteMessage added in v0.6.13

func (m *MockWebSocketConn) WriteMessage(messageType int, data []byte) error

WriteMessage mocks base method.

type MockWebSocketConnMockRecorder added in v0.6.13

type MockWebSocketConnMockRecorder struct {
	// contains filtered or unexported fields
}

MockWebSocketConnMockRecorder is the mock recorder for MockWebSocketConn.

func (*MockWebSocketConnMockRecorder) Close added in v0.6.13

Close indicates an expected call of Close.

func (*MockWebSocketConnMockRecorder) ReadMessage added in v0.6.13

func (mr *MockWebSocketConnMockRecorder) ReadMessage() *gomock.Call

ReadMessage indicates an expected call of ReadMessage.

func (*MockWebSocketConnMockRecorder) SendCloseConnection added in v0.6.13

func (mr *MockWebSocketConnMockRecorder) SendCloseConnection(closeType interface{}) *gomock.Call

SendCloseConnection indicates an expected call of SendCloseConnection.

func (*MockWebSocketConnMockRecorder) SendComplete added in v0.6.13

func (mr *MockWebSocketConnMockRecorder) SendComplete(messageType, id interface{}) *gomock.Call

SendComplete indicates an expected call of SendComplete.

func (*MockWebSocketConnMockRecorder) SendError added in v0.6.13

func (mr *MockWebSocketConnMockRecorder) SendError(messageType, msgID, requestErrors interface{}) *gomock.Call

SendError indicates an expected call of SendError.

func (*MockWebSocketConnMockRecorder) WriteMessage added in v0.6.13

func (mr *MockWebSocketConnMockRecorder) WriteMessage(messageType, data interface{}) *gomock.Call

WriteMessage indicates an expected call of WriteMessage.

type Options added in v0.6.13

type Options struct {
	InitialPoolCapacity int
	ClientPoolCapacity  int
	InsecureConnection  bool
	RootCA              string
	MaxConnsPerHost     int
	ReadTimeout         time.Duration
	WriteTimeout        time.Duration
	DialTimeout         time.Duration
}

type Pool

type Pool interface {
	// Get returns a new ReverseProxy from the pool.
	Get() (HTTPClient, error)

	// Put the ReverseProxy puts it back to the Pool.
	Put(HTTPClient) error

	// Close closes the pool and all its connections. After Close() the pool is
	// no longer usable.
	Close()

	// Len returns the current number of connections of the pool.
	Len() int
}

func NewChanPool

func NewChanPool(hostAddr string, options *Options) (Pool, error)

NewChanPool to new a pool with some params

type WSClientOptions added in v0.6.13

type WSClientOptions struct {
	Scheme             string
	Host               string
	Path               string
	InsecureConnection bool
	RootCA             string
	DialTimeout        time.Duration
}

type WebSocketClient added in v0.6.13

type WebSocketClient interface {
	GetConn(ctx *fasthttp.RequestCtx) (*FastHTTPWebSocketConn, error)
}

WebSocketClient defines the interface for WebSocket connections Pool

func NewWSClient added in v0.6.13

func NewWSClient(logger *logrus.Logger, options *WSClientOptions) (WebSocketClient, error)

type WebSocketConn added in v0.6.13

type WebSocketConn interface {
	ReadMessage() (messageType int, p []byte, err error)
	WriteMessage(messageType int, data []byte) error
	SendError(messageType int, msgID string, requestErrors error) error
	SendComplete(messageType int, id string) error
	SendCloseConnection(closeType int) error
	Close() error
}

WebSocketConn defines the interface for WebSocket connections

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL