Documentation ¶
Index ¶
- type Conn
- type DialOpt
- type DialOptStruct
- type Dialer
- type Factory
- type MessageHandler
- type MockConn
- func (_m *MockConn) AddRoute(_a0 ...dndm.Route)
- func (_m *MockConn) Close() error
- func (_m *MockConn) DelRoute(_a0 ...dndm.Route)
- func (_m *MockConn) EXPECT() *MockConn_Expecter
- func (_m *MockConn) Local() dndm.Peer
- func (_m *MockConn) OnClose(_a0 func()) Conn
- func (_m *MockConn) Read(ctx context.Context) (*core.Header, protoreflect.ProtoMessage, error)
- func (_m *MockConn) Remote() dndm.Peer
- func (_m *MockConn) UpdateRemotePeer(_a0 dndm.Peer) error
- func (_m *MockConn) Write(ctx context.Context, route dndm.Route, msg protoreflect.ProtoMessage) error
- type MockConn_AddRoute_Call
- type MockConn_Close_Call
- type MockConn_DelRoute_Call
- type MockConn_Expecter
- func (_e *MockConn_Expecter) AddRoute(_a0 ...interface{}) *MockConn_AddRoute_Call
- func (_e *MockConn_Expecter) Close() *MockConn_Close_Call
- func (_e *MockConn_Expecter) DelRoute(_a0 ...interface{}) *MockConn_DelRoute_Call
- func (_e *MockConn_Expecter) Local() *MockConn_Local_Call
- func (_e *MockConn_Expecter) OnClose(_a0 interface{}) *MockConn_OnClose_Call
- func (_e *MockConn_Expecter) Read(ctx interface{}) *MockConn_Read_Call
- func (_e *MockConn_Expecter) Remote() *MockConn_Remote_Call
- func (_e *MockConn_Expecter) UpdateRemotePeer(_a0 interface{}) *MockConn_UpdateRemotePeer_Call
- func (_e *MockConn_Expecter) Write(ctx interface{}, route interface{}, msg interface{}) *MockConn_Write_Call
- type MockConn_Local_Call
- type MockConn_OnClose_Call
- type MockConn_Read_Call
- func (_c *MockConn_Read_Call) Return(_a0 *core.Header, _a1 protoreflect.ProtoMessage, _a2 error) *MockConn_Read_Call
- func (_c *MockConn_Read_Call) Run(run func(ctx context.Context)) *MockConn_Read_Call
- func (_c *MockConn_Read_Call) RunAndReturn(run func(context.Context) (*core.Header, protoreflect.ProtoMessage, error)) *MockConn_Read_Call
- type MockConn_Remote_Call
- type MockConn_UpdateRemotePeer_Call
- func (_c *MockConn_UpdateRemotePeer_Call) Return(_a0 error) *MockConn_UpdateRemotePeer_Call
- func (_c *MockConn_UpdateRemotePeer_Call) Run(run func(_a0 dndm.Peer)) *MockConn_UpdateRemotePeer_Call
- func (_c *MockConn_UpdateRemotePeer_Call) RunAndReturn(run func(dndm.Peer) error) *MockConn_UpdateRemotePeer_Call
- type MockConn_Write_Call
- func (_c *MockConn_Write_Call) Return(_a0 error) *MockConn_Write_Call
- func (_c *MockConn_Write_Call) Run(run func(ctx context.Context, route dndm.Route, msg protoreflect.ProtoMessage)) *MockConn_Write_Call
- func (_c *MockConn_Write_Call) RunAndReturn(run func(context.Context, dndm.Route, protoreflect.ProtoMessage) error) *MockConn_Write_Call
- type MockDialer
- type MockDialer_Dial_Call
- func (_c *MockDialer_Dial_Call) Return(_a0 io.ReadWriteCloser, _a1 error) *MockDialer_Dial_Call
- func (_c *MockDialer_Dial_Call) Run(run func(ctx context.Context, peer dndm.Peer, o ...DialOpt)) *MockDialer_Dial_Call
- func (_c *MockDialer_Dial_Call) RunAndReturn(run func(context.Context, dndm.Peer, ...DialOpt) (io.ReadWriteCloser, error)) *MockDialer_Dial_Call
- type MockDialer_Expecter
- type MockDialer_Scheme_Call
- type MockNode
- type MockNode_Dial_Call
- func (_c *MockNode_Dial_Call) Return(_a0 io.ReadWriteCloser, _a1 error) *MockNode_Dial_Call
- func (_c *MockNode_Dial_Call) Run(run func(ctx context.Context, peer dndm.Peer, o ...DialOpt)) *MockNode_Dial_Call
- func (_c *MockNode_Dial_Call) RunAndReturn(run func(context.Context, dndm.Peer, ...DialOpt) (io.ReadWriteCloser, error)) *MockNode_Dial_Call
- type MockNode_Expecter
- type MockNode_Scheme_Call
- type MockNode_Serve_Call
- type MockServer
- type MockServer_Expecter
- type MockServer_Serve_Call
- type Node
- type Server
- type SrvOpt
- type SrvOptStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { io.Closer OnClose(func()) Conn // Local returns the name of the local peer Local() dndm.Peer // Remote returns the name of the remote peer Remote() dndm.Peer // UpdateRemotePeer sets the remote peer name. Peer scheme and address must match to take effect. UpdateRemotePeer(dndm.Peer) error // Read reads a message sent by the peer Read(ctx context.Context) (*types.Header, proto.Message, error) // Write sends a message to the peer Write(ctx context.Context, route dndm.Route, msg proto.Message) error // AddRoute registers a route type. NOTE: Route must have a valid Type AddRoute(...dndm.Route) // DelRoute unregisters a route type. DelRoute(...dndm.Route) }
Conn interface represents a communication channel with the remote peer
type DialOpt ¶
type DialOpt func(*DialOptStruct) error
type DialOptStruct ¶
type DialOptStruct struct { }
type Dialer ¶
type Dialer interface { // Scheme returns the scheme this dialer handles Scheme() string // Dial dials the remote peer and returns a ReadeWriteCloser object Dial(ctx context.Context, peer dndm.Peer, o ...DialOpt) (io.ReadWriteCloser, error) }
Dialer interface describes objects that can dial a remote peer.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
type MessageHandler ¶
type MockConn ¶
MockConn is an autogenerated mock type for the Conn type
func NewMockConn ¶
NewMockConn creates a new instance of MockConn. 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 (*MockConn) EXPECT ¶
func (_m *MockConn) EXPECT() *MockConn_Expecter
func (*MockConn) Read ¶
func (_m *MockConn) Read(ctx context.Context) (*core.Header, protoreflect.ProtoMessage, error)
Read provides a mock function with given fields: ctx
func (*MockConn) UpdateRemotePeer ¶
UpdateRemotePeer provides a mock function with given fields: _a0
func (*MockConn) Write ¶
func (_m *MockConn) Write(ctx context.Context, route dndm.Route, msg protoreflect.ProtoMessage) error
Write provides a mock function with given fields: ctx, route, msg
type MockConn_AddRoute_Call ¶
MockConn_AddRoute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRoute'
func (*MockConn_AddRoute_Call) Return ¶
func (_c *MockConn_AddRoute_Call) Return() *MockConn_AddRoute_Call
func (*MockConn_AddRoute_Call) Run ¶
func (_c *MockConn_AddRoute_Call) Run(run func(_a0 ...dndm.Route)) *MockConn_AddRoute_Call
func (*MockConn_AddRoute_Call) RunAndReturn ¶
func (_c *MockConn_AddRoute_Call) RunAndReturn(run func(...dndm.Route)) *MockConn_AddRoute_Call
type MockConn_Close_Call ¶
MockConn_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
func (*MockConn_Close_Call) Return ¶
func (_c *MockConn_Close_Call) Return(_a0 error) *MockConn_Close_Call
func (*MockConn_Close_Call) Run ¶
func (_c *MockConn_Close_Call) Run(run func()) *MockConn_Close_Call
func (*MockConn_Close_Call) RunAndReturn ¶
func (_c *MockConn_Close_Call) RunAndReturn(run func() error) *MockConn_Close_Call
type MockConn_DelRoute_Call ¶
MockConn_DelRoute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DelRoute'
func (*MockConn_DelRoute_Call) Return ¶
func (_c *MockConn_DelRoute_Call) Return() *MockConn_DelRoute_Call
func (*MockConn_DelRoute_Call) Run ¶
func (_c *MockConn_DelRoute_Call) Run(run func(_a0 ...dndm.Route)) *MockConn_DelRoute_Call
func (*MockConn_DelRoute_Call) RunAndReturn ¶
func (_c *MockConn_DelRoute_Call) RunAndReturn(run func(...dndm.Route)) *MockConn_DelRoute_Call
type MockConn_Expecter ¶
type MockConn_Expecter struct {
// contains filtered or unexported fields
}
func (*MockConn_Expecter) AddRoute ¶
func (_e *MockConn_Expecter) AddRoute(_a0 ...interface{}) *MockConn_AddRoute_Call
AddRoute is a helper method to define mock.On call
- _a0 ...dndm.Route
func (*MockConn_Expecter) Close ¶
func (_e *MockConn_Expecter) Close() *MockConn_Close_Call
Close is a helper method to define mock.On call
func (*MockConn_Expecter) DelRoute ¶
func (_e *MockConn_Expecter) DelRoute(_a0 ...interface{}) *MockConn_DelRoute_Call
DelRoute is a helper method to define mock.On call
- _a0 ...dndm.Route
func (*MockConn_Expecter) Local ¶
func (_e *MockConn_Expecter) Local() *MockConn_Local_Call
Local is a helper method to define mock.On call
func (*MockConn_Expecter) OnClose ¶
func (_e *MockConn_Expecter) OnClose(_a0 interface{}) *MockConn_OnClose_Call
OnClose is a helper method to define mock.On call
- _a0 func()
func (*MockConn_Expecter) Read ¶
func (_e *MockConn_Expecter) Read(ctx interface{}) *MockConn_Read_Call
Read is a helper method to define mock.On call
- ctx context.Context
func (*MockConn_Expecter) Remote ¶
func (_e *MockConn_Expecter) Remote() *MockConn_Remote_Call
Remote is a helper method to define mock.On call
func (*MockConn_Expecter) UpdateRemotePeer ¶
func (_e *MockConn_Expecter) UpdateRemotePeer(_a0 interface{}) *MockConn_UpdateRemotePeer_Call
UpdateRemotePeer is a helper method to define mock.On call
- _a0 dndm.Peer
func (*MockConn_Expecter) Write ¶
func (_e *MockConn_Expecter) Write(ctx interface{}, route interface{}, msg interface{}) *MockConn_Write_Call
Write is a helper method to define mock.On call
- ctx context.Context
- route dndm.Route
- msg protoreflect.ProtoMessage
type MockConn_Local_Call ¶
MockConn_Local_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Local'
func (*MockConn_Local_Call) Return ¶
func (_c *MockConn_Local_Call) Return(_a0 dndm.Peer) *MockConn_Local_Call
func (*MockConn_Local_Call) Run ¶
func (_c *MockConn_Local_Call) Run(run func()) *MockConn_Local_Call
func (*MockConn_Local_Call) RunAndReturn ¶
func (_c *MockConn_Local_Call) RunAndReturn(run func() dndm.Peer) *MockConn_Local_Call
type MockConn_OnClose_Call ¶
MockConn_OnClose_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnClose'
func (*MockConn_OnClose_Call) Return ¶
func (_c *MockConn_OnClose_Call) Return(_a0 Conn) *MockConn_OnClose_Call
func (*MockConn_OnClose_Call) Run ¶
func (_c *MockConn_OnClose_Call) Run(run func(_a0 func())) *MockConn_OnClose_Call
func (*MockConn_OnClose_Call) RunAndReturn ¶
func (_c *MockConn_OnClose_Call) RunAndReturn(run func(func()) Conn) *MockConn_OnClose_Call
type MockConn_Read_Call ¶
MockConn_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'
func (*MockConn_Read_Call) Return ¶
func (_c *MockConn_Read_Call) Return(_a0 *core.Header, _a1 protoreflect.ProtoMessage, _a2 error) *MockConn_Read_Call
func (*MockConn_Read_Call) Run ¶
func (_c *MockConn_Read_Call) Run(run func(ctx context.Context)) *MockConn_Read_Call
func (*MockConn_Read_Call) RunAndReturn ¶
func (_c *MockConn_Read_Call) RunAndReturn(run func(context.Context) (*core.Header, protoreflect.ProtoMessage, error)) *MockConn_Read_Call
type MockConn_Remote_Call ¶
MockConn_Remote_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remote'
func (*MockConn_Remote_Call) Return ¶
func (_c *MockConn_Remote_Call) Return(_a0 dndm.Peer) *MockConn_Remote_Call
func (*MockConn_Remote_Call) Run ¶
func (_c *MockConn_Remote_Call) Run(run func()) *MockConn_Remote_Call
func (*MockConn_Remote_Call) RunAndReturn ¶
func (_c *MockConn_Remote_Call) RunAndReturn(run func() dndm.Peer) *MockConn_Remote_Call
type MockConn_UpdateRemotePeer_Call ¶
MockConn_UpdateRemotePeer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRemotePeer'
func (*MockConn_UpdateRemotePeer_Call) Return ¶
func (_c *MockConn_UpdateRemotePeer_Call) Return(_a0 error) *MockConn_UpdateRemotePeer_Call
func (*MockConn_UpdateRemotePeer_Call) Run ¶
func (_c *MockConn_UpdateRemotePeer_Call) Run(run func(_a0 dndm.Peer)) *MockConn_UpdateRemotePeer_Call
func (*MockConn_UpdateRemotePeer_Call) RunAndReturn ¶
func (_c *MockConn_UpdateRemotePeer_Call) RunAndReturn(run func(dndm.Peer) error) *MockConn_UpdateRemotePeer_Call
type MockConn_Write_Call ¶
MockConn_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
func (*MockConn_Write_Call) Return ¶
func (_c *MockConn_Write_Call) Return(_a0 error) *MockConn_Write_Call
func (*MockConn_Write_Call) Run ¶
func (_c *MockConn_Write_Call) Run(run func(ctx context.Context, route dndm.Route, msg protoreflect.ProtoMessage)) *MockConn_Write_Call
func (*MockConn_Write_Call) RunAndReturn ¶
func (_c *MockConn_Write_Call) RunAndReturn(run func(context.Context, dndm.Route, protoreflect.ProtoMessage) error) *MockConn_Write_Call
type MockDialer ¶
MockDialer is an autogenerated mock type for the Dialer type
func NewMockDialer ¶
func NewMockDialer(t interface { mock.TestingT Cleanup(func()) }) *MockDialer
NewMockDialer creates a new instance of MockDialer. 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 (*MockDialer) Dial ¶
func (_m *MockDialer) Dial(ctx context.Context, peer dndm.Peer, o ...DialOpt) (io.ReadWriteCloser, error)
Dial provides a mock function with given fields: ctx, peer, o
func (*MockDialer) EXPECT ¶
func (_m *MockDialer) EXPECT() *MockDialer_Expecter
func (*MockDialer) Scheme ¶
func (_m *MockDialer) Scheme() string
Scheme provides a mock function with given fields:
type MockDialer_Dial_Call ¶
MockDialer_Dial_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dial'
func (*MockDialer_Dial_Call) Return ¶
func (_c *MockDialer_Dial_Call) Return(_a0 io.ReadWriteCloser, _a1 error) *MockDialer_Dial_Call
func (*MockDialer_Dial_Call) Run ¶
func (_c *MockDialer_Dial_Call) Run(run func(ctx context.Context, peer dndm.Peer, o ...DialOpt)) *MockDialer_Dial_Call
func (*MockDialer_Dial_Call) RunAndReturn ¶
func (_c *MockDialer_Dial_Call) RunAndReturn(run func(context.Context, dndm.Peer, ...DialOpt) (io.ReadWriteCloser, error)) *MockDialer_Dial_Call
type MockDialer_Expecter ¶
type MockDialer_Expecter struct {
// contains filtered or unexported fields
}
func (*MockDialer_Expecter) Dial ¶
func (_e *MockDialer_Expecter) Dial(ctx interface{}, peer interface{}, o ...interface{}) *MockDialer_Dial_Call
Dial is a helper method to define mock.On call
- ctx context.Context
- peer dndm.Peer
- o ...DialOpt
func (*MockDialer_Expecter) Scheme ¶
func (_e *MockDialer_Expecter) Scheme() *MockDialer_Scheme_Call
Scheme is a helper method to define mock.On call
type MockDialer_Scheme_Call ¶
MockDialer_Scheme_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Scheme'
func (*MockDialer_Scheme_Call) Return ¶
func (_c *MockDialer_Scheme_Call) Return(_a0 string) *MockDialer_Scheme_Call
func (*MockDialer_Scheme_Call) Run ¶
func (_c *MockDialer_Scheme_Call) Run(run func()) *MockDialer_Scheme_Call
func (*MockDialer_Scheme_Call) RunAndReturn ¶
func (_c *MockDialer_Scheme_Call) RunAndReturn(run func() string) *MockDialer_Scheme_Call
type MockNode ¶
MockNode is an autogenerated mock type for the Node type
func NewMockNode ¶
NewMockNode creates a new instance of MockNode. 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 (*MockNode) Dial ¶
func (_m *MockNode) Dial(ctx context.Context, peer dndm.Peer, o ...DialOpt) (io.ReadWriteCloser, error)
Dial provides a mock function with given fields: ctx, peer, o
func (*MockNode) EXPECT ¶
func (_m *MockNode) EXPECT() *MockNode_Expecter
type MockNode_Dial_Call ¶
MockNode_Dial_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dial'
func (*MockNode_Dial_Call) Return ¶
func (_c *MockNode_Dial_Call) Return(_a0 io.ReadWriteCloser, _a1 error) *MockNode_Dial_Call
func (*MockNode_Dial_Call) Run ¶
func (_c *MockNode_Dial_Call) Run(run func(ctx context.Context, peer dndm.Peer, o ...DialOpt)) *MockNode_Dial_Call
func (*MockNode_Dial_Call) RunAndReturn ¶
func (_c *MockNode_Dial_Call) RunAndReturn(run func(context.Context, dndm.Peer, ...DialOpt) (io.ReadWriteCloser, error)) *MockNode_Dial_Call
type MockNode_Expecter ¶
type MockNode_Expecter struct {
// contains filtered or unexported fields
}
func (*MockNode_Expecter) Dial ¶
func (_e *MockNode_Expecter) Dial(ctx interface{}, peer interface{}, o ...interface{}) *MockNode_Dial_Call
Dial is a helper method to define mock.On call
- ctx context.Context
- peer dndm.Peer
- o ...DialOpt
func (*MockNode_Expecter) Scheme ¶
func (_e *MockNode_Expecter) Scheme() *MockNode_Scheme_Call
Scheme is a helper method to define mock.On call
func (*MockNode_Expecter) Serve ¶
func (_e *MockNode_Expecter) Serve(ctx interface{}, onConnect interface{}, o ...interface{}) *MockNode_Serve_Call
Serve is a helper method to define mock.On call
- ctx context.Context
- onConnect func(dndm.Peer , io.ReadWriteCloser) error
- o ...SrvOpt
type MockNode_Scheme_Call ¶
MockNode_Scheme_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Scheme'
func (*MockNode_Scheme_Call) Return ¶
func (_c *MockNode_Scheme_Call) Return(_a0 string) *MockNode_Scheme_Call
func (*MockNode_Scheme_Call) Run ¶
func (_c *MockNode_Scheme_Call) Run(run func()) *MockNode_Scheme_Call
func (*MockNode_Scheme_Call) RunAndReturn ¶
func (_c *MockNode_Scheme_Call) RunAndReturn(run func() string) *MockNode_Scheme_Call
type MockNode_Serve_Call ¶
MockNode_Serve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Serve'
func (*MockNode_Serve_Call) Return ¶
func (_c *MockNode_Serve_Call) Return(_a0 error) *MockNode_Serve_Call
func (*MockNode_Serve_Call) Run ¶
func (_c *MockNode_Serve_Call) Run(run func(ctx context.Context, onConnect func(dndm.Peer, io.ReadWriteCloser) error, o ...SrvOpt)) *MockNode_Serve_Call
func (*MockNode_Serve_Call) RunAndReturn ¶
func (_c *MockNode_Serve_Call) RunAndReturn(run func(context.Context, func(dndm.Peer, io.ReadWriteCloser) error, ...SrvOpt) error) *MockNode_Serve_Call
type MockServer ¶
MockServer is an autogenerated mock type for the Server type
func NewMockServer ¶
func NewMockServer(t interface { mock.TestingT Cleanup(func()) }) *MockServer
NewMockServer creates a new instance of MockServer. 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 (*MockServer) EXPECT ¶
func (_m *MockServer) EXPECT() *MockServer_Expecter
type MockServer_Expecter ¶
type MockServer_Expecter struct {
// contains filtered or unexported fields
}
func (*MockServer_Expecter) Serve ¶
func (_e *MockServer_Expecter) Serve(ctx interface{}, onConnect interface{}, o ...interface{}) *MockServer_Serve_Call
Serve is a helper method to define mock.On call
- ctx context.Context
- onConnect func(dndm.Peer , io.ReadWriteCloser) error
- o ...SrvOpt
type MockServer_Serve_Call ¶
MockServer_Serve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Serve'
func (*MockServer_Serve_Call) Return ¶
func (_c *MockServer_Serve_Call) Return(_a0 error) *MockServer_Serve_Call
func (*MockServer_Serve_Call) Run ¶
func (_c *MockServer_Serve_Call) Run(run func(ctx context.Context, onConnect func(dndm.Peer, io.ReadWriteCloser) error, o ...SrvOpt)) *MockServer_Serve_Call
func (*MockServer_Serve_Call) RunAndReturn ¶
func (_c *MockServer_Serve_Call) RunAndReturn(run func(context.Context, func(dndm.Peer, io.ReadWriteCloser) error, ...SrvOpt) error) *MockServer_Serve_Call
type Server ¶
type Server interface {
Serve(ctx context.Context, onConnect func(peer dndm.Peer, r io.ReadWriteCloser) error, o ...SrvOpt) error
}
Server interface describes objects that can listen for connections.
type SrvOpt ¶
type SrvOpt func(*SrvOptStruct) error
type SrvOptStruct ¶
type SrvOptStruct struct { }