api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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"`
}

type MockBFFService added in v0.0.3

type MockBFFService struct {
	mock.Mock
}

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 (*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

type MockBFFService_PassThrough_Call struct {
	*mock.Call
}

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 (*MockBFFService_PassThrough_Call) Run added in v0.0.3

func (*MockBFFService_PassThrough_Call) RunAndReturn added in v0.0.3

type MockBFFService_ProcessRequest_Call added in v0.0.3

type MockBFFService_ProcessRequest_Call struct {
	*mock.Call
}

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 (*MockBFFService_ProcessRequest_Call) Run added in v0.0.3

func (*MockBFFService_ProcessRequest_Call) RunAndReturn added in v0.0.3

type Service

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

func NewSevice

func NewSevice(cfg *Config, handler BFFService) *Service

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) Handle

func (s *Service) Handle(conn wasabi.Connection, r wasabi.Request) error

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) Run

func (s *Service) Run(ctx context.Context) error

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.

Jump to

Keyboard shortcuts

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