Documentation
¶
Index ¶
- type BFFService
- type Config
- type GeneralRateLimits
- type GroupRateLimits
- type MockBFFService
- type MockBFFService_Expecter
- type MockBFFService_PassThrough_Call
- func (_c *MockBFFService_PassThrough_Call) Return(_a0 error) *MockBFFService_PassThrough_Call
- func (_c *MockBFFService_PassThrough_Call) Run(run func(clientConn wasabi.Connection, req *request.Request)) *MockBFFService_PassThrough_Call
- func (_c *MockBFFService_PassThrough_Call) RunAndReturn(run func(wasabi.Connection, *request.Request) error) *MockBFFService_PassThrough_Call
- type MockBFFService_ProcessRequest_Call
- func (_c *MockBFFService_ProcessRequest_Call) Return(_a0 error) *MockBFFService_ProcessRequest_Call
- func (_c *MockBFFService_ProcessRequest_Call) Run(run func(clientConn wasabi.Connection, req *request.Request)) *MockBFFService_ProcessRequest_Call
- func (_c *MockBFFService_ProcessRequest_Call) RunAndReturn(run func(wasabi.Connection, *request.Request) error) *MockBFFService_ProcessRequest_Call
- type RateLimits
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BFFService ¶
type BFFService interface { PassThrough(clientConn wasabi.Connection, req *request.Request) error ProcessRequest(clientConn wasabi.Connection, req *request.Request) error }
type Config ¶
type Config struct { Listen string `mapstructure:"listen"` RateLimits RateLimits `mapstructure:"rate_limits"` MaxRequests uint `mapstructure:"max_requests"` MaxRequestsPerConn uint `mapstructure:"max_requests_per_conn"` }
type GeneralRateLimits ¶ added in v0.6.1
type GroupRateLimits ¶ added in v0.6.1
type GroupRateLimits struct { Name string `mapstructure:"name"` Limits GeneralRateLimits `mapstructure:"limits"` Methods []string `mapstructure:"methods"` }
type MockBFFService ¶ added in v0.0.3
MockBFFService is an autogenerated mock type for the BFFService type
func NewMockBFFService ¶ added in v0.0.3
func NewMockBFFService(t interface { mock.TestingT Cleanup(func()) }) *MockBFFService
NewMockBFFService creates a new instance of MockBFFService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBFFService) EXPECT ¶ added in v0.0.3
func (_m *MockBFFService) EXPECT() *MockBFFService_Expecter
func (*MockBFFService) PassThrough ¶ added in v0.0.3
func (_m *MockBFFService) PassThrough(clientConn wasabi.Connection, req *request.Request) error
PassThrough provides a mock function with given fields: clientConn, req
func (*MockBFFService) ProcessRequest ¶ added in v0.0.3
func (_m *MockBFFService) ProcessRequest(clientConn wasabi.Connection, req *request.Request) error
ProcessRequest provides a mock function with given fields: clientConn, req
type MockBFFService_Expecter ¶ added in v0.0.3
type MockBFFService_Expecter struct {
// contains filtered or unexported fields
}
func (*MockBFFService_Expecter) PassThrough ¶ added in v0.0.3
func (_e *MockBFFService_Expecter) PassThrough(clientConn interface{}, req interface{}) *MockBFFService_PassThrough_Call
PassThrough is a helper method to define mock.On call
- clientConn wasabi.Connection
- req *request.Request
func (*MockBFFService_Expecter) ProcessRequest ¶ added in v0.0.3
func (_e *MockBFFService_Expecter) ProcessRequest(clientConn interface{}, req interface{}) *MockBFFService_ProcessRequest_Call
ProcessRequest is a helper method to define mock.On call
- clientConn wasabi.Connection
- req *request.Request
type MockBFFService_PassThrough_Call ¶ added in v0.0.3
MockBFFService_PassThrough_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PassThrough'
func (*MockBFFService_PassThrough_Call) Return ¶ added in v0.0.3
func (_c *MockBFFService_PassThrough_Call) Return(_a0 error) *MockBFFService_PassThrough_Call
func (*MockBFFService_PassThrough_Call) Run ¶ added in v0.0.3
func (_c *MockBFFService_PassThrough_Call) Run(run func(clientConn wasabi.Connection, req *request.Request)) *MockBFFService_PassThrough_Call
func (*MockBFFService_PassThrough_Call) RunAndReturn ¶ added in v0.0.3
func (_c *MockBFFService_PassThrough_Call) RunAndReturn(run func(wasabi.Connection, *request.Request) error) *MockBFFService_PassThrough_Call
type MockBFFService_ProcessRequest_Call ¶ added in v0.0.3
MockBFFService_ProcessRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessRequest'
func (*MockBFFService_ProcessRequest_Call) Return ¶ added in v0.0.3
func (_c *MockBFFService_ProcessRequest_Call) Return(_a0 error) *MockBFFService_ProcessRequest_Call
func (*MockBFFService_ProcessRequest_Call) Run ¶ added in v0.0.3
func (_c *MockBFFService_ProcessRequest_Call) Run(run func(clientConn wasabi.Connection, req *request.Request)) *MockBFFService_ProcessRequest_Call
func (*MockBFFService_ProcessRequest_Call) RunAndReturn ¶ added in v0.0.3
func (_c *MockBFFService_ProcessRequest_Call) RunAndReturn(run func(wasabi.Connection, *request.Request) error) *MockBFFService_ProcessRequest_Call
type RateLimits ¶ added in v0.6.1
type RateLimits struct { Groups []GroupRateLimits `mapstructure:"groups"` General GeneralRateLimits `mapstructure:"general"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewSevice ¶
func NewSevice(cfg *Config, handler BFFService) (*Service, error)
NewSevice creates a new instance of Service with the provided configuration and handler. It takes cfg of type *Config and handler of type BFFService. It returns a pointer to a Service struct.
func (*Service) Addr ¶ added in v0.3.0
Addr returns the network address the server is listening on. It takes no parameters. It returns a net.Addr which represents the server's network address.
func (*Service) Handle ¶
Handle processes a request received on a connection and routes it based on the request type. It takes conn of type wasabi.Connection and r of type wasabi.Request. It returns an error if the request type is unsupported or if the request type is empty. If the request type is core.TextMessage or core.BinaryMessage, it passes the request through to the handler. For other request types, it processes the request using the handler.
func (*Service) HealthCheck ¶ added in v0.6.0
func (s *Service) HealthCheck(w http.ResponseWriter, _ *http.Request)
HealthCheck handles HTTP requests for checking the health status of the service. It takes a ResponseWriter to write the HTTP response and a Request which represents the client's request. It returns an HTTP status code 200 (OK) and a plain text message "OK".
func (*Service) Run ¶
Run starts the service and listens for incoming connections. It takes a context.Context parameter which is used to manage the lifecycle of the service. It returns an error if the server fails to start or close properly. The function sets up a dispatcher, a connection registry, and a channel endpoint with middleware. It also handles graceful shutdown when the context is done.