Documentation ¶
Overview ¶
Package proxy is a generated GoMock package.
Package proxy is a generated GoMock package.
Package proxy is a generated GoMock package.
Package proxy is a generated GoMock package.
Index ¶
- func Perform(ctx *fasthttp.RequestCtx, proxyPool Pool, customHostHeader string) error
- type DNSCache
- type DNSCacheOptions
- type FastHTTPWebSocketClient
- type FastHTTPWebSocketConn
- func (f *FastHTTPWebSocketConn) Close() error
- func (f *FastHTTPWebSocketConn) ReadMessage() (messageType int, p []byte, err error)
- func (f *FastHTTPWebSocketConn) SendCloseConnection(closeType int) error
- func (f *FastHTTPWebSocketConn) SendComplete(messageType int, id string) error
- func (f *FastHTTPWebSocketConn) SendError(messageType int, msgID string, requestErrors error) error
- func (f *FastHTTPWebSocketConn) WriteMessage(messageType int, data []byte) error
- type GqlWSErrorMessage
- type HTTPClient
- type MockDNSCache
- type MockDNSCacheMockRecorder
- type MockHTTPClient
- type MockHTTPClientMockRecorder
- type MockPool
- type MockPoolMockRecorder
- type MockWebSocketClient
- type MockWebSocketClientMockRecorder
- type MockWebSocketConn
- func (m *MockWebSocketConn) Close() error
- func (m *MockWebSocketConn) EXPECT() *MockWebSocketConnMockRecorder
- func (m *MockWebSocketConn) ReadMessage() (int, []byte, error)
- func (m *MockWebSocketConn) SendCloseConnection(closeType int) error
- func (m *MockWebSocketConn) SendComplete(messageType int, id string) error
- func (m *MockWebSocketConn) SendError(messageType int, msgID string, requestErrors error) error
- func (m *MockWebSocketConn) WriteMessage(messageType int, data []byte) error
- type MockWebSocketConnMockRecorder
- func (mr *MockWebSocketConnMockRecorder) Close() *gomock.Call
- func (mr *MockWebSocketConnMockRecorder) ReadMessage() *gomock.Call
- func (mr *MockWebSocketConnMockRecorder) SendCloseConnection(closeType interface{}) *gomock.Call
- func (mr *MockWebSocketConnMockRecorder) SendComplete(messageType, id interface{}) *gomock.Call
- func (mr *MockWebSocketConnMockRecorder) SendError(messageType, msgID, requestErrors interface{}) *gomock.Call
- func (mr *MockWebSocketConnMockRecorder) WriteMessage(messageType, data interface{}) *gomock.Call
- type Options
- type Pool
- type Resolver
- type WSClientOptions
- type WebSocketClient
- type WebSocketConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DNSCache ¶ added in v0.8.0
type DNSCache interface { LookupIPAddr(context.Context, string) (names []net.IPAddr, err error) Refresh() Stop() }
func NewDNSResolver ¶ added in v0.8.0
func NewDNSResolver(resolver *net.Resolver, options *DNSCacheOptions) (DNSCache, error)
NewDNSResolver initializes DNS cache resolver and starts auto refreshing in a new goroutine. To stop refreshing, call `Stop()` function.
type DNSCacheOptions ¶ added in v0.8.2
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
func (f *FastHTTPWebSocketClient) GetConn(ctx *fasthttp.RequestCtx) (*FastHTTPWebSocketConn, error)
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 MockDNSCache ¶ added in v0.8.0
type MockDNSCache struct {
// contains filtered or unexported fields
}
MockDNSCache is a mock of DNSCache interface.
func NewMockDNSCache ¶ added in v0.8.0
func NewMockDNSCache(ctrl *gomock.Controller) *MockDNSCache
NewMockDNSCache creates a new mock instance.
func (*MockDNSCache) EXPECT ¶ added in v0.8.0
func (m *MockDNSCache) EXPECT() *MockDNSCacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDNSCache) LookupIPAddr ¶ added in v0.8.2
LookupIPAddr mocks base method.
func (*MockDNSCache) Refresh ¶ added in v0.8.0
func (m *MockDNSCache) Refresh()
Refresh mocks base method.
type MockDNSCacheMockRecorder ¶ added in v0.8.0
type MockDNSCacheMockRecorder struct {
// contains filtered or unexported fields
}
MockDNSCacheMockRecorder is the mock recorder for MockDNSCache.
func (*MockDNSCacheMockRecorder) LookupIPAddr ¶ added in v0.8.2
func (mr *MockDNSCacheMockRecorder) LookupIPAddr(arg0, arg1 interface{}) *gomock.Call
LookupIPAddr indicates an expected call of LookupIPAddr.
func (*MockDNSCacheMockRecorder) Refresh ¶ added in v0.8.0
func (mr *MockDNSCacheMockRecorder) Refresh() *gomock.Call
Refresh indicates an expected call of Refresh.
func (*MockDNSCacheMockRecorder) Stop ¶ added in v0.8.0
func (mr *MockDNSCacheMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
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) EXPECT ¶ added in v0.6.9
func (m *MockHTTPClient) EXPECT() *MockHTTPClientMockRecorder
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) EXPECT ¶ added in v0.6.9
func (m *MockPool) EXPECT() *MockPoolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
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) Put ¶ added in v0.6.9
func (mr *MockPoolMockRecorder) Put(arg0, arg1 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
func (m *MockWebSocketClient) EXPECT() *MockWebSocketClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockWebSocketClient) GetConn ¶ added in v0.6.13
func (m *MockWebSocketClient) GetConn(ctx *fasthttp.RequestCtx) (*FastHTTPWebSocketConn, error)
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
func (m *MockWebSocketConn) EXPECT() *MockWebSocketConnMockRecorder
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
func (mr *MockWebSocketConnMockRecorder) Close() *gomock.Call
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 DNSConfig config.DNS ReadTimeout time.Duration WriteTimeout time.Duration DialTimeout time.Duration ReadBufferSize int WriteBufferSize int MaxResponseBodySize int Logger *logrus.Logger DNSResolver DNSCache }
type Pool ¶
type Pool interface { // Get returns a new ReverseProxy from the pool. Get() (HTTPClient, string, error) // Put the ReverseProxy puts it back to the Pool. Put(string, HTTPClient) error // Close closes the pool and all its connections. After Close() the pool is // no longer usable. Close() }
type Resolver ¶ added in v0.8.0
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is DNS cache resolver which cache DNS resolve results in memory.
func (*Resolver) LookupIPAddr ¶ added in v0.8.2
LookupIPAddr lookups IP list from the cache and returns DNS server then it saves result in the cache. If you want to get result from the cache use `Fetch` function.
type WSClientOptions ¶ added in v0.6.13
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