Documentation ¶
Index ¶
- Variables
- type ConnResult
- type ConnectionQueue
- type MockConnectionQueue
- type MockConnectionQueue_AddConnection_Call
- func (_c *MockConnectionQueue_AddConnection_Call) Return(_a0 error) *MockConnectionQueue_AddConnection_Call
- func (_c *MockConnectionQueue_AddConnection_Call) Run(run func(id uint64, conn ConnResult)) *MockConnectionQueue_AddConnection_Call
- func (_c *MockConnectionQueue_AddConnection_Call) RunAndReturn(run func(uint64, ConnResult) error) *MockConnectionQueue_AddConnection_Call
- type MockConnectionQueue_AddRequest_Call
- func (_c *MockConnectionQueue_AddRequest_Call) Return(_a0 uint64) *MockConnectionQueue_AddRequest_Call
- func (_c *MockConnectionQueue_AddRequest_Call) Run(run func(connChan chan ConnResult)) *MockConnectionQueue_AddRequest_Call
- func (_c *MockConnectionQueue_AddRequest_Call) RunAndReturn(run func(chan ConnResult) uint64) *MockConnectionQueue_AddRequest_Call
- type MockConnectionQueue_Expecter
- type MockRevProxyRepo
- type MockRevProxyRepo_Expecter
- type MockRevProxyRepo_Find_Call
- func (_c *MockRevProxyRepo_Find_Call) Return(_a0 *RevProxy, _a1 error) *MockRevProxyRepo_Find_Call
- func (_c *MockRevProxyRepo_Find_Call) Run(run func(nameSpace string)) *MockRevProxyRepo_Find_Call
- func (_c *MockRevProxyRepo_Find_Call) RunAndReturn(run func(string) (*RevProxy, error)) *MockRevProxyRepo_Find_Call
- type MockRevProxyRepo_Register_Call
- type MockRevProxyRepo_Unregister_Call
- func (_c *MockRevProxyRepo_Unregister_Call) Return() *MockRevProxyRepo_Unregister_Call
- func (_c *MockRevProxyRepo_Unregister_Call) Run(run func(proxy *RevProxy)) *MockRevProxyRepo_Unregister_Call
- func (_c *MockRevProxyRepo_Unregister_Call) RunAndReturn(run func(*RevProxy)) *MockRevProxyRepo_Unregister_Call
- type RevProxy
- type RevProxyCommand
- type RevProxyRepo
- type Service
- func (s *Service) AddConnection(id uint64, conn net.Conn) error
- func (s *Service) NewConnection(ctx context.Context, addr *network.Address) (net.Conn, error)
- func (s *Service) RegisterRevProxy(_ context.Context, nameSpace string, services []string) (*RevProxy, error)
- func (s *Service) UnregisterRevProxy(proxy *RevProxy)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNameSpaceEmpty = fmt.Errorf("name space is empty") ErrServicesEmpty = fmt.Errorf("services list is empty") ErrDuplicateService = fmt.Errorf("duplicate service name") ErrRevProxyStopped = fmt.Errorf("revproxy is stopped") ErrServiceNameEmpty = fmt.Errorf("service name is empty") ErrRevProxyStarted = fmt.Errorf("revproxy is already started") )
var ErrConnReqNotFound = fmt.Errorf("connection request not found")
Functions ¶
This section is empty.
Types ¶
type ConnResult ¶
type ConnectionQueue ¶
type ConnectionQueue interface { AddRequest(connChan chan ConnResult) uint64 AddConnection(id uint64, conn ConnResult) error }
type MockConnectionQueue ¶
MockConnectionQueue is an autogenerated mock type for the ConnectionQueue type
func NewMockConnectionQueue ¶
func NewMockConnectionQueue(t interface { mock.TestingT Cleanup(func()) }) *MockConnectionQueue
NewMockConnectionQueue creates a new instance of MockConnectionQueue. 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 (*MockConnectionQueue) AddConnection ¶
func (_m *MockConnectionQueue) AddConnection(id uint64, conn ConnResult) error
AddConnection provides a mock function with given fields: id, conn
func (*MockConnectionQueue) AddRequest ¶
func (_m *MockConnectionQueue) AddRequest(connChan chan ConnResult) uint64
AddRequest provides a mock function with given fields: connChan
func (*MockConnectionQueue) EXPECT ¶
func (_m *MockConnectionQueue) EXPECT() *MockConnectionQueue_Expecter
type MockConnectionQueue_AddConnection_Call ¶
MockConnectionQueue_AddConnection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddConnection'
func (*MockConnectionQueue_AddConnection_Call) Return ¶
func (_c *MockConnectionQueue_AddConnection_Call) Return(_a0 error) *MockConnectionQueue_AddConnection_Call
func (*MockConnectionQueue_AddConnection_Call) Run ¶
func (_c *MockConnectionQueue_AddConnection_Call) Run(run func(id uint64, conn ConnResult)) *MockConnectionQueue_AddConnection_Call
func (*MockConnectionQueue_AddConnection_Call) RunAndReturn ¶
func (_c *MockConnectionQueue_AddConnection_Call) RunAndReturn(run func(uint64, ConnResult) error) *MockConnectionQueue_AddConnection_Call
type MockConnectionQueue_AddRequest_Call ¶
MockConnectionQueue_AddRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRequest'
func (*MockConnectionQueue_AddRequest_Call) Return ¶
func (_c *MockConnectionQueue_AddRequest_Call) Return(_a0 uint64) *MockConnectionQueue_AddRequest_Call
func (*MockConnectionQueue_AddRequest_Call) Run ¶
func (_c *MockConnectionQueue_AddRequest_Call) Run(run func(connChan chan ConnResult)) *MockConnectionQueue_AddRequest_Call
func (*MockConnectionQueue_AddRequest_Call) RunAndReturn ¶
func (_c *MockConnectionQueue_AddRequest_Call) RunAndReturn(run func(chan ConnResult) uint64) *MockConnectionQueue_AddRequest_Call
type MockConnectionQueue_Expecter ¶
type MockConnectionQueue_Expecter struct {
// contains filtered or unexported fields
}
func (*MockConnectionQueue_Expecter) AddConnection ¶
func (_e *MockConnectionQueue_Expecter) AddConnection(id interface{}, conn interface{}) *MockConnectionQueue_AddConnection_Call
AddConnection is a helper method to define mock.On call
- id uint64
- conn ConnResult
func (*MockConnectionQueue_Expecter) AddRequest ¶
func (_e *MockConnectionQueue_Expecter) AddRequest(connChan interface{}) *MockConnectionQueue_AddRequest_Call
AddRequest is a helper method to define mock.On call
- connChan chan ConnResult
type MockRevProxyRepo ¶
MockRevProxyRepo is an autogenerated mock type for the RevProxyRepo type
func NewMockRevProxyRepo ¶
func NewMockRevProxyRepo(t interface { mock.TestingT Cleanup(func()) }) *MockRevProxyRepo
NewMockRevProxyRepo creates a new instance of MockRevProxyRepo. 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 (*MockRevProxyRepo) EXPECT ¶
func (_m *MockRevProxyRepo) EXPECT() *MockRevProxyRepo_Expecter
func (*MockRevProxyRepo) Find ¶
func (_m *MockRevProxyRepo) Find(nameSpace string) (*RevProxy, error)
Find provides a mock function with given fields: nameSpace
func (*MockRevProxyRepo) Register ¶
func (_m *MockRevProxyRepo) Register(proxy *RevProxy)
Register provides a mock function with given fields: proxy
func (*MockRevProxyRepo) Unregister ¶
func (_m *MockRevProxyRepo) Unregister(proxy *RevProxy)
Unregister provides a mock function with given fields: proxy
type MockRevProxyRepo_Expecter ¶
type MockRevProxyRepo_Expecter struct {
// contains filtered or unexported fields
}
func (*MockRevProxyRepo_Expecter) Find ¶
func (_e *MockRevProxyRepo_Expecter) Find(nameSpace interface{}) *MockRevProxyRepo_Find_Call
Find is a helper method to define mock.On call
- nameSpace string
func (*MockRevProxyRepo_Expecter) Register ¶
func (_e *MockRevProxyRepo_Expecter) Register(proxy interface{}) *MockRevProxyRepo_Register_Call
Register is a helper method to define mock.On call
- proxy *RevProxy
func (*MockRevProxyRepo_Expecter) Unregister ¶
func (_e *MockRevProxyRepo_Expecter) Unregister(proxy interface{}) *MockRevProxyRepo_Unregister_Call
Unregister is a helper method to define mock.On call
- proxy *RevProxy
type MockRevProxyRepo_Find_Call ¶
MockRevProxyRepo_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'
func (*MockRevProxyRepo_Find_Call) Return ¶
func (_c *MockRevProxyRepo_Find_Call) Return(_a0 *RevProxy, _a1 error) *MockRevProxyRepo_Find_Call
func (*MockRevProxyRepo_Find_Call) Run ¶
func (_c *MockRevProxyRepo_Find_Call) Run(run func(nameSpace string)) *MockRevProxyRepo_Find_Call
func (*MockRevProxyRepo_Find_Call) RunAndReturn ¶
func (_c *MockRevProxyRepo_Find_Call) RunAndReturn(run func(string) (*RevProxy, error)) *MockRevProxyRepo_Find_Call
type MockRevProxyRepo_Register_Call ¶
MockRevProxyRepo_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register'
func (*MockRevProxyRepo_Register_Call) Return ¶
func (_c *MockRevProxyRepo_Register_Call) Return() *MockRevProxyRepo_Register_Call
func (*MockRevProxyRepo_Register_Call) Run ¶
func (_c *MockRevProxyRepo_Register_Call) Run(run func(proxy *RevProxy)) *MockRevProxyRepo_Register_Call
func (*MockRevProxyRepo_Register_Call) RunAndReturn ¶
func (_c *MockRevProxyRepo_Register_Call) RunAndReturn(run func(*RevProxy)) *MockRevProxyRepo_Register_Call
type MockRevProxyRepo_Unregister_Call ¶
MockRevProxyRepo_Unregister_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unregister'
func (*MockRevProxyRepo_Unregister_Call) Return ¶
func (_c *MockRevProxyRepo_Unregister_Call) Return() *MockRevProxyRepo_Unregister_Call
func (*MockRevProxyRepo_Unregister_Call) Run ¶
func (_c *MockRevProxyRepo_Unregister_Call) Run(run func(proxy *RevProxy)) *MockRevProxyRepo_Unregister_Call
func (*MockRevProxyRepo_Unregister_Call) RunAndReturn ¶
func (_c *MockRevProxyRepo_Unregister_Call) RunAndReturn(run func(*RevProxy)) *MockRevProxyRepo_Unregister_Call
type RevProxy ¶
type RevProxy struct { NameSpace string Services []string // contains filtered or unexported fields }
func NewRevProxy ¶
NewRevProxy creates a new RevProxy with the specified name space and services. It returns an error if the name space is empty or if the services list is empty. It also returns an error if the services list contains duplicate service names. The RevProxy is created with an empty command stream.
func (*RevProxy) CommandStream ¶
func (r *RevProxy) CommandStream() <-chan RevProxyCommand
CommandStream returns a read-only channel of RevProxyCommand. This channel is used to receive commands for the RevProxy. Any commands sent through this channel will be processed by the RevProxy. The returned channel is read-only, meaning it can only be used for receiving commands.
func (*RevProxy) RequestConnection ¶
RequestConnection sends a request to establish a connection with the specified ID and name. It returns an error if the context is canceled or if the command cannot be sent to the command stream.
type RevProxyCommand ¶
type RevProxyRepo ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(revProxyRepo RevProxyRepo, connQueue ConnectionQueue) *Service
New creates a new instance of the Service. It takes a RevProxyRepo and a ConnectionQueue as parameters. It returns a pointer to the newly created Service.
func (*Service) AddConnection ¶
AddConnection adds a connection to the connection queue. It returns an error if the connection queue cannot add the connection.
func (*Service) NewConnection ¶
NewConnection creates a new connection. It takes a context and an address as parameters. It returns a net.Conn and an error.
func (*Service) RegisterRevProxy ¶
func (s *Service) RegisterRevProxy(_ context.Context, nameSpace string, services []string) (*RevProxy, error)
RegisterRevProxy registers the reverse connection proxy. It takes a context, namespace, and services as parameters. It returns a pointer to a RevProxy and an error.
func (*Service) UnregisterRevProxy ¶
UnregisterRevProxy unregisters the reverse connection proxy. It takes a pointer to a RevProxy as a parameter.