socket

package
v0.0.0-...-0765ed5 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed      = errors.New("socket closed")
	ErrReadTimeout = errors.New("read timeout")
	ErrSendTimeout = errors.New("send timeout")
)

Functions

func ListenToFreePort

func ListenToFreePort(socket mangos.Socket, host string) (int, error)

func WithReadTimeout

func WithReadTimeout(t time.Duration) func(OptionSetter) error

func WithSendTimeout

func WithSendTimeout(t time.Duration) func(OptionSetter) error

Types

type Base

type Base interface {
	GetHost() string
	GetPort() int
	Close() error
}

type MockBase

type MockBase struct {
	mock.Mock
}

MockBase is an autogenerated mock type for the Base type

func NewMockBase

func NewMockBase(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockBase

NewMockBase creates a new instance of MockBase. 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 (*MockBase) Close

func (_m *MockBase) Close() error

Close provides a mock function with given fields:

func (*MockBase) GetHost

func (_m *MockBase) GetHost() string

GetHost provides a mock function with given fields:

func (*MockBase) GetPort

func (_m *MockBase) GetPort() int

GetPort provides a mock function with given fields:

type MockOptionSetter

type MockOptionSetter struct {
	mock.Mock
}

MockOptionSetter is an autogenerated mock type for the OptionSetter type

func NewMockOptionSetter

func NewMockOptionSetter(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockOptionSetter

NewMockOptionSetter creates a new instance of MockOptionSetter. 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 (*MockOptionSetter) SetOption

func (_m *MockOptionSetter) SetOption(name string, value interface{}) error

SetOption provides a mock function with given fields: name, value

type MockReplier

type MockReplier struct {
	mock.Mock
}

MockReplier is an autogenerated mock type for the Replier type

func NewMockReplier

func NewMockReplier(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockReplier

NewMockReplier creates a new instance of MockReplier. 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 (*MockReplier) Close

func (_m *MockReplier) Close() error

Close provides a mock function with given fields:

func (*MockReplier) GetHost

func (_m *MockReplier) GetHost() string

GetHost provides a mock function with given fields:

func (*MockReplier) GetPort

func (_m *MockReplier) GetPort() int

GetPort provides a mock function with given fields:

func (*MockReplier) Receive

func (_m *MockReplier) Receive(msg proto.Message, opt ...func(OptionSetter) error) (ReplierSocket, error)

Receive provides a mock function with given fields: msg, opt

type MockReplierSocket

type MockReplierSocket struct {
	mock.Mock
}

MockReplierSocket is an autogenerated mock type for the ReplierSocket type

func NewMockReplierSocket

func NewMockReplierSocket(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockReplierSocket

NewMockReplierSocket creates a new instance of MockReplierSocket. 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 (*MockReplierSocket) Reply

func (_m *MockReplierSocket) Reply(msg proto.Message, opt ...func(OptionSetter) error) error

Reply provides a mock function with given fields: msg, opt

type MockRequester

type MockRequester struct {
	mock.Mock
}

MockRequester is an autogenerated mock type for the Requester type

func NewMockRequester

func NewMockRequester(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRequester

NewMockRequester creates a new instance of MockRequester. 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 (*MockRequester) Close

func (_m *MockRequester) Close() error

Close provides a mock function with given fields:

func (*MockRequester) GetHost

func (_m *MockRequester) GetHost() string

GetHost provides a mock function with given fields:

func (*MockRequester) GetPort

func (_m *MockRequester) GetPort() int

GetPort provides a mock function with given fields:

func (*MockRequester) Request

func (_m *MockRequester) Request(msg proto.Message, reply proto.Message, opts ...func(OptionSetter) error) error

Request provides a mock function with given fields: msg, reply, opts

type MockSubscriber

type MockSubscriber struct {
	mock.Mock
}

MockSubscriber is an autogenerated mock type for the Subscriber type

func NewMockSubscriber

func NewMockSubscriber(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockSubscriber

NewMockSubscriber creates a new instance of MockSubscriber. 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 (*MockSubscriber) Close

func (_m *MockSubscriber) Close() error

Close provides a mock function with given fields:

func (*MockSubscriber) GetHost

func (_m *MockSubscriber) GetHost() string

GetHost provides a mock function with given fields:

func (*MockSubscriber) GetPort

func (_m *MockSubscriber) GetPort() int

GetPort provides a mock function with given fields:

func (*MockSubscriber) Receive

func (_m *MockSubscriber) Receive(msg proto.Message, opt ...func(OptionSetter) error) error

Receive provides a mock function with given fields: msg, opt

type OptionSetter

type OptionSetter interface {
	SetOption(name string, value interface{}) error
}

type Options

type Options struct {
	SendTimeout time.Duration
	ReadTimeout time.Duration
}

type Replier

type Replier interface {
	Base
	Receive(msg proto.Message, opt ...func(OptionSetter) error) (ReplierSocket, error)
}

func NewReplier

func NewReplier(host string, port int, dial bool, options ...func(OptionSetter) error) (Replier, error)

type ReplierSocket

type ReplierSocket interface {
	Reply(msg proto.Message, opt ...func(OptionSetter) error) error
}

type Requester

type Requester interface {
	Base
	Request(msg proto.Message, reply proto.Message, opts ...func(OptionSetter) error) error
}

func NewRequester

func NewRequester(host string, port int, dial bool, options ...func(OptionSetter) error) (Requester, error)

type Subscriber

type Subscriber interface {
	Base
	Receive(msg proto.Message, opt ...func(OptionSetter) error) error
}

func NewSubscriber

func NewSubscriber(host string, port int, options ...func(OptionSetter) error) (Subscriber, error)

Jump to

Keyboard shortcuts

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