Documentation
¶
Overview ¶
Package kim is a generated GoMock package.
Package kim is a generated GoMock package.
Package kim is a generated GoMock package.
Index ¶
- Constants
- Variables
- func FromRequest(r *http.Request) string
- func GetLocalIP() string
- func RealIP(r *http.Request) string
- type Acceptor
- type Agent
- type Channel
- type ChannelImpl
- func (ch *ChannelImpl) Close() error
- func (ch *ChannelImpl) GetMeta() Meta
- func (ch *ChannelImpl) ID() string
- func (ch *ChannelImpl) Push(payload []byte) error
- func (ch *ChannelImpl) Readloop(lst MessageListener) error
- func (ch *ChannelImpl) SetReadWait(readwait time.Duration)
- func (ch *ChannelImpl) SetWriteWait(writeWait time.Duration)
- type ChannelMap
- type ChannelsImpl
- type Client
- type Conn
- type Context
- type ContextImpl
- func (c *ContextImpl) Dispatch(body proto.Message, recvs ...*Location) error
- func (c *ContextImpl) Header() *pkt.Header
- func (c *ContextImpl) Next()
- func (c *ContextImpl) ReadBody(val proto.Message) error
- func (c *ContextImpl) Resp(status pkt.Status, body proto.Message) error
- func (c *ContextImpl) RespWithError(status pkt.Status, err error) error
- func (c *ContextImpl) Session() Session
- type DefaultServer
- func (s *DefaultServer) Push(id string, data []byte) error
- func (s *DefaultServer) SetAcceptor(acceptor Acceptor)
- func (s *DefaultServer) SetChannelMap(channels ChannelMap)
- func (s *DefaultServer) SetMessageListener(listener MessageListener)
- func (s *DefaultServer) SetReadWait(Readwait time.Duration)
- func (s *DefaultServer) SetStateListener(listener StateListener)
- func (s *DefaultServer) Shutdown(ctx context.Context) error
- func (s *DefaultServer) Start() error
- type Dialer
- type DialerContext
- type Dispatcher
- type Event
- type Frame
- type FuncTree
- type HandlerFunc
- type HandlersChain
- type Location
- type MessageListener
- type Meta
- type MockAcceptor
- type MockAcceptorMockRecorder
- type MockAgent
- type MockAgentMockRecorder
- type MockChannel
- func (m *MockChannel) Close() error
- func (m *MockChannel) EXPECT() *MockChannelMockRecorder
- func (m *MockChannel) Flush() error
- func (m *MockChannel) GetMeta() Meta
- func (m *MockChannel) ID() string
- func (m *MockChannel) LocalAddr() net.Addr
- func (m *MockChannel) Push(arg0 []byte) error
- func (m *MockChannel) Read(b []byte) (int, error)
- func (m *MockChannel) ReadFrame() (Frame, error)
- func (m *MockChannel) Readloop(lst MessageListener) error
- func (m *MockChannel) RemoteAddr() net.Addr
- func (m *MockChannel) SetDeadline(t time.Time) error
- func (m *MockChannel) SetReadDeadline(t time.Time) error
- func (m *MockChannel) SetReadWait(arg0 time.Duration)
- func (m *MockChannel) SetWriteDeadline(t time.Time) error
- func (m *MockChannel) SetWriteWait(arg0 time.Duration)
- func (m *MockChannel) Write(b []byte) (int, error)
- func (m *MockChannel) WriteFrame(arg0 OpCode, arg1 []byte) error
- type MockChannelMockRecorder
- func (mr *MockChannelMockRecorder) Close() *gomock.Call
- func (mr *MockChannelMockRecorder) Flush() *gomock.Call
- func (mr *MockChannelMockRecorder) GetMeta() *gomock.Call
- func (mr *MockChannelMockRecorder) ID() *gomock.Call
- func (mr *MockChannelMockRecorder) LocalAddr() *gomock.Call
- func (mr *MockChannelMockRecorder) Push(arg0 interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) Read(b interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) ReadFrame() *gomock.Call
- func (mr *MockChannelMockRecorder) Readloop(lst interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) RemoteAddr() *gomock.Call
- func (mr *MockChannelMockRecorder) SetDeadline(t interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) SetReadWait(arg0 interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) SetWriteWait(arg0 interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) Write(b interface{}) *gomock.Call
- func (mr *MockChannelMockRecorder) WriteFrame(arg0, arg1 interface{}) *gomock.Call
- type MockClient
- func (m *MockClient) Close()
- func (m *MockClient) Connect(arg0 string) error
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) GetMeta() map[string]string
- func (m *MockClient) Read() (Frame, error)
- func (m *MockClient) Send(arg0 []byte) error
- func (m *MockClient) ServiceID() string
- func (m *MockClient) ServiceName() string
- func (m *MockClient) SetDialer(arg0 Dialer)
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) Close() *gomock.Call
- func (mr *MockClientMockRecorder) Connect(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GetMeta() *gomock.Call
- func (mr *MockClientMockRecorder) Read() *gomock.Call
- func (mr *MockClientMockRecorder) Send(arg0 interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) ServiceID() *gomock.Call
- func (mr *MockClientMockRecorder) ServiceName() *gomock.Call
- func (mr *MockClientMockRecorder) SetDialer(arg0 interface{}) *gomock.Call
- type MockConn
- func (m *MockConn) Close() error
- func (m *MockConn) EXPECT() *MockConnMockRecorder
- func (m *MockConn) Flush() error
- func (m *MockConn) LocalAddr() net.Addr
- func (m *MockConn) Read(b []byte) (int, error)
- func (m *MockConn) ReadFrame() (Frame, error)
- func (m *MockConn) RemoteAddr() net.Addr
- func (m *MockConn) SetDeadline(t time.Time) error
- func (m *MockConn) SetReadDeadline(t time.Time) error
- func (m *MockConn) SetWriteDeadline(t time.Time) error
- func (m *MockConn) Write(b []byte) (int, error)
- func (m *MockConn) WriteFrame(arg0 OpCode, arg1 []byte) error
- type MockConnMockRecorder
- func (mr *MockConnMockRecorder) Close() *gomock.Call
- func (mr *MockConnMockRecorder) Flush() *gomock.Call
- func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call
- func (mr *MockConnMockRecorder) Read(b interface{}) *gomock.Call
- func (mr *MockConnMockRecorder) ReadFrame() *gomock.Call
- func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call
- func (mr *MockConnMockRecorder) SetDeadline(t interface{}) *gomock.Call
- func (mr *MockConnMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
- func (mr *MockConnMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
- func (mr *MockConnMockRecorder) Write(b interface{}) *gomock.Call
- func (mr *MockConnMockRecorder) WriteFrame(arg0, arg1 interface{}) *gomock.Call
- type MockDialer
- type MockDialerMockRecorder
- type MockDispatcher
- type MockDispatcherMockRecorder
- type MockFrame
- type MockFrameMockRecorder
- type MockMessageListener
- type MockMessageListenerMockRecorder
- type MockServer
- func (m *MockServer) DialURL() string
- func (m *MockServer) EXPECT() *MockServerMockRecorder
- func (m *MockServer) GetMeta() map[string]string
- func (m *MockServer) GetNamespace() string
- func (m *MockServer) GetProtocol() string
- func (m *MockServer) GetTags() []string
- func (m *MockServer) PublicAddress() string
- func (m *MockServer) PublicPort() int
- func (m *MockServer) Push(arg0 string, arg1 []byte) error
- func (m *MockServer) ServiceID() string
- func (m *MockServer) ServiceName() string
- func (m *MockServer) SetAcceptor(arg0 Acceptor)
- func (m *MockServer) SetChannelMap(arg0 ChannelMap)
- func (m *MockServer) SetMessageListener(arg0 MessageListener)
- func (m *MockServer) SetReadWait(arg0 time.Duration)
- func (m *MockServer) SetStateListener(arg0 StateListener)
- func (m *MockServer) Shutdown(arg0 context.Context) error
- func (m *MockServer) Start() error
- func (m *MockServer) String() string
- type MockServerMockRecorder
- func (mr *MockServerMockRecorder) DialURL() *gomock.Call
- func (mr *MockServerMockRecorder) GetMeta() *gomock.Call
- func (mr *MockServerMockRecorder) GetNamespace() *gomock.Call
- func (mr *MockServerMockRecorder) GetProtocol() *gomock.Call
- func (mr *MockServerMockRecorder) GetTags() *gomock.Call
- func (mr *MockServerMockRecorder) PublicAddress() *gomock.Call
- func (mr *MockServerMockRecorder) PublicPort() *gomock.Call
- func (mr *MockServerMockRecorder) Push(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) ServiceID() *gomock.Call
- func (mr *MockServerMockRecorder) ServiceName() *gomock.Call
- func (mr *MockServerMockRecorder) SetAcceptor(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) SetChannelMap(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) SetMessageListener(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) SetReadWait(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) SetStateListener(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) Shutdown(arg0 interface{}) *gomock.Call
- func (mr *MockServerMockRecorder) Start() *gomock.Call
- func (mr *MockServerMockRecorder) String() *gomock.Call
- type MockService
- type MockServiceMockRecorder
- type MockServiceRegistration
- func (m *MockServiceRegistration) DialURL() string
- func (m *MockServiceRegistration) EXPECT() *MockServiceRegistrationMockRecorder
- func (m *MockServiceRegistration) GetMeta() map[string]string
- func (m *MockServiceRegistration) GetNamespace() string
- func (m *MockServiceRegistration) GetProtocol() string
- func (m *MockServiceRegistration) GetTags() []string
- func (m *MockServiceRegistration) PublicAddress() string
- func (m *MockServiceRegistration) PublicPort() int
- func (m *MockServiceRegistration) ServiceID() string
- func (m *MockServiceRegistration) ServiceName() string
- func (m *MockServiceRegistration) String() string
- type MockServiceRegistrationMockRecorder
- func (mr *MockServiceRegistrationMockRecorder) DialURL() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) GetMeta() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) GetNamespace() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) GetProtocol() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) GetTags() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) PublicAddress() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) PublicPort() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) ServiceID() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) ServiceName() *gomock.Call
- func (mr *MockServiceRegistrationMockRecorder) String() *gomock.Call
- type MockSessionStorage
- func (m *MockSessionStorage) Add(session *pkt.Session) error
- func (m *MockSessionStorage) Delete(account, channelId string) error
- func (m *MockSessionStorage) EXPECT() *MockSessionStorageMockRecorder
- func (m *MockSessionStorage) Get(channelId string) (*pkt.Session, error)
- func (m *MockSessionStorage) GetLocation(account, device string) (*Location, error)
- func (m *MockSessionStorage) GetLocations(account ...string) ([]*Location, error)
- type MockSessionStorageMockRecorder
- func (mr *MockSessionStorageMockRecorder) Add(session interface{}) *gomock.Call
- func (mr *MockSessionStorageMockRecorder) Delete(account, channelId interface{}) *gomock.Call
- func (mr *MockSessionStorageMockRecorder) Get(channelId interface{}) *gomock.Call
- func (mr *MockSessionStorageMockRecorder) GetLocation(account, device interface{}) *gomock.Call
- func (mr *MockSessionStorageMockRecorder) GetLocations(account ...interface{}) *gomock.Call
- type MockStateListener
- type MockStateListenerMockRecorder
- type OpCode
- type Router
- type Server
- type ServerOption
- type ServerOptions
- type Service
- type ServiceRegistration
- type Session
- type SessionStorage
- type StateListener
- type Upgrader
Constants ¶
const ( DefaultReadWait = time.Minute * 3 DefaultWriteWait = time.Second * 10 DefaultLoginWait = time.Second * 10 DefaultHeartbeat = time.Second * 55 )
const ( // 定义读取消息的默认goroutine池大小 DefaultMessageReadPool = 5000 DefaultConnectionPool = 5000 )
Variables ¶
var ErrSessionLost = errors.New("err:session lost")
var ErrSessionNil = errors.New("err:session nil")
ErrNil
Functions ¶
func FromRequest ¶
FromRequest return client's real public IP address from http request headers.
Types ¶
type Acceptor ¶
type Acceptor interface { // Accept 返回一个握手完成的Channel对象或者一个error。 // 业务层需要处理不同协议和网络环境下的连接握手协议 Accept(Conn, time.Duration) (string, Meta, error) }
Acceptor 连接接收器
type Channel ¶
type Channel interface { Conn Agent // Close 关闭连接 Close() error Readloop(lst MessageListener) error // SetWriteWait 设置写超时 SetWriteWait(time.Duration) SetReadWait(time.Duration) }
Channel is interface of client side
type ChannelImpl ¶
type ChannelImpl struct { Conn // contains filtered or unexported fields }
ChannelImpl is a websocket implement of channel
func (*ChannelImpl) GetMeta ¶
func (ch *ChannelImpl) GetMeta() Meta
func (*ChannelImpl) Readloop ¶
func (ch *ChannelImpl) Readloop(lst MessageListener) error
Declare a function called Readloop that belongs to the ChannelImpl struct. This function takes in a MessageListener as a parameter and returns an error (if there is one).
func (*ChannelImpl) SetReadWait ¶
func (ch *ChannelImpl) SetReadWait(readwait time.Duration)
func (*ChannelImpl) SetWriteWait ¶
func (ch *ChannelImpl) SetWriteWait(writeWait time.Duration)
SetWriteWait 设置写超时
type ChannelMap ¶
type ChannelMap interface { Add(channel Channel) Remove(id string) Get(id string) (channel Channel, ok bool) All() []Channel }
ChannelMap ChannelMap
type ChannelsImpl ¶
type ChannelsImpl struct {
// contains filtered or unexported fields
}
ChannelsImpl ChannelMap
type Client ¶
type Client interface { Service // connect to server Connect(string) error // SetDialer 设置拨号处理器 SetDialer(Dialer) Send([]byte) error Read() (Frame, error) // Close 关闭 Close() }
Client is interface of client side
type Conn ¶
type Conn interface { net.Conn ReadFrame() (Frame, error) WriteFrame(OpCode, []byte) error Flush() error }
Conn Connection
type Context ¶
type Context interface { Dispatcher SessionStorage Header() *pkt.Header ReadBody(val proto.Message) error Session() Session RespWithError(status pkt.Status, err error) error Resp(status pkt.Status, body proto.Message) error Dispatch(body proto.Message, recvs ...*Location) error Next() }
func BuildContext ¶
func BuildContext() Context
type ContextImpl ¶
type ContextImpl struct { sync.Mutex Dispatcher SessionStorage // contains filtered or unexported fields }
ContextImpl is the most important part of kim
func (*ContextImpl) Dispatch ¶
func (c *ContextImpl) Dispatch(body proto.Message, recvs ...*Location) error
Dispatch the packet to the Destination of request, the header flag of this packet will be set with FlagDelivery exceptMe: exclude self if self is false
func (*ContextImpl) Header ¶
func (c *ContextImpl) Header() *pkt.Header
func (*ContextImpl) Resp ¶
Resp send a response message to sender, the header of packet copied from request
func (*ContextImpl) RespWithError ¶
func (c *ContextImpl) RespWithError(status pkt.Status, err error) error
RespWithError response with error
func (*ContextImpl) Session ¶
func (c *ContextImpl) Session() Session
type DefaultServer ¶
type DefaultServer struct { Upgrader ServiceRegistration ChannelMap Acceptor MessageListener StateListener // contains filtered or unexported fields }
DefaultServer is a websocket implement of the DefaultServer
func NewServer ¶
func NewServer(listen string, service ServiceRegistration, upgrader Upgrader, options ...ServerOption) *DefaultServer
NewServer NewServer
func (*DefaultServer) Push ¶
func (s *DefaultServer) Push(id string, data []byte) error
string channelID []byte data
func (*DefaultServer) SetAcceptor ¶
func (s *DefaultServer) SetAcceptor(acceptor Acceptor)
SetAcceptor SetAcceptor
func (*DefaultServer) SetChannelMap ¶
func (s *DefaultServer) SetChannelMap(channels ChannelMap)
SetChannels SetChannels
func (*DefaultServer) SetMessageListener ¶
func (s *DefaultServer) SetMessageListener(listener MessageListener)
SetMessageListener SetMessageListener
func (*DefaultServer) SetReadWait ¶
func (s *DefaultServer) SetReadWait(Readwait time.Duration)
SetReadWait set read wait duration
func (*DefaultServer) SetStateListener ¶
func (s *DefaultServer) SetStateListener(listener StateListener)
SetStateListener SetStateListener
type Dialer ¶
type Dialer interface {
DialAndHandshake(DialerContext) (net.Conn, error)
}
Dialer Dialer
type DialerContext ¶
type Dispatcher ¶
Dispatcher defined a component how a message be dispatched to gateway
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event represents a one-time event that may occur in the future.
func (*Event) Done ¶
func (e *Event) Done() <-chan struct{}
Done returns a channel that will be closed when Fire is called.
type Frame ¶
type Frame interface { SetOpCode(OpCode) GetOpCode() OpCode SetPayload([]byte) GetPayload() []byte }
Frame Frame
type FuncTree ¶
type FuncTree struct {
// contains filtered or unexported fields
}
FuncTree is a tree structure
func (*FuncTree) Add ¶
func (t *FuncTree) Add(path string, handlers ...HandlerFunc)
Add a handler to tree
type MessageListener ¶
MessageListener 监听消息
type MockAcceptor ¶
type MockAcceptor struct {
// contains filtered or unexported fields
}
MockAcceptor is a mock of Acceptor interface.
func NewMockAcceptor ¶
func NewMockAcceptor(ctrl *gomock.Controller) *MockAcceptor
NewMockAcceptor creates a new mock instance.
func (*MockAcceptor) EXPECT ¶
func (m *MockAcceptor) EXPECT() *MockAcceptorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAcceptorMockRecorder ¶
type MockAcceptorMockRecorder struct {
// contains filtered or unexported fields
}
MockAcceptorMockRecorder is the mock recorder for MockAcceptor.
func (*MockAcceptorMockRecorder) Accept ¶
func (mr *MockAcceptorMockRecorder) Accept(arg0, arg1 interface{}) *gomock.Call
Accept indicates an expected call of Accept.
type MockAgent ¶
type MockAgent struct {
// contains filtered or unexported fields
}
MockAgent is a mock of Agent interface.
func NewMockAgent ¶
func NewMockAgent(ctrl *gomock.Controller) *MockAgent
NewMockAgent creates a new mock instance.
func (*MockAgent) EXPECT ¶
func (m *MockAgent) EXPECT() *MockAgentMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAgentMockRecorder ¶
type MockAgentMockRecorder struct {
// contains filtered or unexported fields
}
MockAgentMockRecorder is the mock recorder for MockAgent.
func (*MockAgentMockRecorder) GetMeta ¶
func (mr *MockAgentMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockAgentMockRecorder) ID ¶
func (mr *MockAgentMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockAgentMockRecorder) Push ¶
func (mr *MockAgentMockRecorder) Push(arg0 interface{}) *gomock.Call
Push indicates an expected call of Push.
type MockChannel ¶
type MockChannel struct {
// contains filtered or unexported fields
}
MockChannel is a mock of Channel interface.
func NewMockChannel ¶
func NewMockChannel(ctrl *gomock.Controller) *MockChannel
NewMockChannel creates a new mock instance.
func (*MockChannel) EXPECT ¶
func (m *MockChannel) EXPECT() *MockChannelMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockChannel) LocalAddr ¶
func (m *MockChannel) LocalAddr() net.Addr
LocalAddr mocks base method.
func (*MockChannel) Read ¶
func (m *MockChannel) Read(b []byte) (int, error)
Read mocks base method.
func (*MockChannel) ReadFrame ¶
func (m *MockChannel) ReadFrame() (Frame, error)
ReadFrame mocks base method.
func (*MockChannel) Readloop ¶
func (m *MockChannel) Readloop(lst MessageListener) error
Readloop mocks base method.
func (*MockChannel) RemoteAddr ¶
func (m *MockChannel) RemoteAddr() net.Addr
RemoteAddr mocks base method.
func (*MockChannel) SetDeadline ¶
func (m *MockChannel) SetDeadline(t time.Time) error
SetDeadline mocks base method.
func (*MockChannel) SetReadDeadline ¶
func (m *MockChannel) SetReadDeadline(t time.Time) error
SetReadDeadline mocks base method.
func (*MockChannel) SetReadWait ¶
func (m *MockChannel) SetReadWait(arg0 time.Duration)
SetReadWait mocks base method.
func (*MockChannel) SetWriteDeadline ¶
func (m *MockChannel) SetWriteDeadline(t time.Time) error
SetWriteDeadline mocks base method.
func (*MockChannel) SetWriteWait ¶
func (m *MockChannel) SetWriteWait(arg0 time.Duration)
SetWriteWait mocks base method.
func (*MockChannel) Write ¶
func (m *MockChannel) Write(b []byte) (int, error)
Write mocks base method.
func (*MockChannel) WriteFrame ¶
func (m *MockChannel) WriteFrame(arg0 OpCode, arg1 []byte) error
WriteFrame mocks base method.
type MockChannelMockRecorder ¶
type MockChannelMockRecorder struct {
// contains filtered or unexported fields
}
MockChannelMockRecorder is the mock recorder for MockChannel.
func (*MockChannelMockRecorder) Close ¶
func (mr *MockChannelMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockChannelMockRecorder) Flush ¶
func (mr *MockChannelMockRecorder) Flush() *gomock.Call
Flush indicates an expected call of Flush.
func (*MockChannelMockRecorder) GetMeta ¶
func (mr *MockChannelMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockChannelMockRecorder) ID ¶
func (mr *MockChannelMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockChannelMockRecorder) LocalAddr ¶
func (mr *MockChannelMockRecorder) LocalAddr() *gomock.Call
LocalAddr indicates an expected call of LocalAddr.
func (*MockChannelMockRecorder) Push ¶
func (mr *MockChannelMockRecorder) Push(arg0 interface{}) *gomock.Call
Push indicates an expected call of Push.
func (*MockChannelMockRecorder) Read ¶
func (mr *MockChannelMockRecorder) Read(b interface{}) *gomock.Call
Read indicates an expected call of Read.
func (*MockChannelMockRecorder) ReadFrame ¶
func (mr *MockChannelMockRecorder) ReadFrame() *gomock.Call
ReadFrame indicates an expected call of ReadFrame.
func (*MockChannelMockRecorder) Readloop ¶
func (mr *MockChannelMockRecorder) Readloop(lst interface{}) *gomock.Call
Readloop indicates an expected call of Readloop.
func (*MockChannelMockRecorder) RemoteAddr ¶
func (mr *MockChannelMockRecorder) RemoteAddr() *gomock.Call
RemoteAddr indicates an expected call of RemoteAddr.
func (*MockChannelMockRecorder) SetDeadline ¶
func (mr *MockChannelMockRecorder) SetDeadline(t interface{}) *gomock.Call
SetDeadline indicates an expected call of SetDeadline.
func (*MockChannelMockRecorder) SetReadDeadline ¶
func (mr *MockChannelMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
SetReadDeadline indicates an expected call of SetReadDeadline.
func (*MockChannelMockRecorder) SetReadWait ¶
func (mr *MockChannelMockRecorder) SetReadWait(arg0 interface{}) *gomock.Call
SetReadWait indicates an expected call of SetReadWait.
func (*MockChannelMockRecorder) SetWriteDeadline ¶
func (mr *MockChannelMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
SetWriteDeadline indicates an expected call of SetWriteDeadline.
func (*MockChannelMockRecorder) SetWriteWait ¶
func (mr *MockChannelMockRecorder) SetWriteWait(arg0 interface{}) *gomock.Call
SetWriteWait indicates an expected call of SetWriteWait.
func (*MockChannelMockRecorder) Write ¶
func (mr *MockChannelMockRecorder) Write(b interface{}) *gomock.Call
Write indicates an expected call of Write.
func (*MockChannelMockRecorder) WriteFrame ¶
func (mr *MockChannelMockRecorder) WriteFrame(arg0, arg1 interface{}) *gomock.Call
WriteFrame indicates an expected call of WriteFrame.
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) Connect ¶
func (m *MockClient) Connect(arg0 string) error
Connect mocks base method.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) GetMeta ¶
func (m *MockClient) GetMeta() map[string]string
GetMeta mocks base method.
func (*MockClient) ServiceName ¶
func (m *MockClient) ServiceName() string
ServiceName mocks base method.
func (*MockClient) SetDialer ¶
func (m *MockClient) SetDialer(arg0 Dialer)
SetDialer mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) Close ¶
func (mr *MockClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockClientMockRecorder) Connect ¶
func (mr *MockClientMockRecorder) Connect(arg0 interface{}) *gomock.Call
Connect indicates an expected call of Connect.
func (*MockClientMockRecorder) GetMeta ¶
func (mr *MockClientMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockClientMockRecorder) Read ¶
func (mr *MockClientMockRecorder) Read() *gomock.Call
Read indicates an expected call of Read.
func (*MockClientMockRecorder) Send ¶
func (mr *MockClientMockRecorder) Send(arg0 interface{}) *gomock.Call
Send indicates an expected call of Send.
func (*MockClientMockRecorder) ServiceID ¶
func (mr *MockClientMockRecorder) ServiceID() *gomock.Call
ServiceID indicates an expected call of ServiceID.
func (*MockClientMockRecorder) ServiceName ¶
func (mr *MockClientMockRecorder) ServiceName() *gomock.Call
ServiceName indicates an expected call of ServiceName.
func (*MockClientMockRecorder) SetDialer ¶
func (mr *MockClientMockRecorder) SetDialer(arg0 interface{}) *gomock.Call
SetDialer indicates an expected call of SetDialer.
type MockConn ¶
type MockConn struct {
// contains filtered or unexported fields
}
MockConn is a mock of Conn interface.
func NewMockConn ¶
func NewMockConn(ctrl *gomock.Controller) *MockConn
NewMockConn creates a new mock instance.
func (*MockConn) EXPECT ¶
func (m *MockConn) EXPECT() *MockConnMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConn) RemoteAddr ¶
RemoteAddr mocks base method.
func (*MockConn) SetDeadline ¶
SetDeadline mocks base method.
func (*MockConn) SetReadDeadline ¶
SetReadDeadline mocks base method.
func (*MockConn) SetWriteDeadline ¶
SetWriteDeadline mocks base method.
type MockConnMockRecorder ¶
type MockConnMockRecorder struct {
// contains filtered or unexported fields
}
MockConnMockRecorder is the mock recorder for MockConn.
func (*MockConnMockRecorder) Close ¶
func (mr *MockConnMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockConnMockRecorder) Flush ¶
func (mr *MockConnMockRecorder) Flush() *gomock.Call
Flush indicates an expected call of Flush.
func (*MockConnMockRecorder) LocalAddr ¶
func (mr *MockConnMockRecorder) LocalAddr() *gomock.Call
LocalAddr indicates an expected call of LocalAddr.
func (*MockConnMockRecorder) Read ¶
func (mr *MockConnMockRecorder) Read(b interface{}) *gomock.Call
Read indicates an expected call of Read.
func (*MockConnMockRecorder) ReadFrame ¶
func (mr *MockConnMockRecorder) ReadFrame() *gomock.Call
ReadFrame indicates an expected call of ReadFrame.
func (*MockConnMockRecorder) RemoteAddr ¶
func (mr *MockConnMockRecorder) RemoteAddr() *gomock.Call
RemoteAddr indicates an expected call of RemoteAddr.
func (*MockConnMockRecorder) SetDeadline ¶
func (mr *MockConnMockRecorder) SetDeadline(t interface{}) *gomock.Call
SetDeadline indicates an expected call of SetDeadline.
func (*MockConnMockRecorder) SetReadDeadline ¶
func (mr *MockConnMockRecorder) SetReadDeadline(t interface{}) *gomock.Call
SetReadDeadline indicates an expected call of SetReadDeadline.
func (*MockConnMockRecorder) SetWriteDeadline ¶
func (mr *MockConnMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call
SetWriteDeadline indicates an expected call of SetWriteDeadline.
func (*MockConnMockRecorder) Write ¶
func (mr *MockConnMockRecorder) Write(b interface{}) *gomock.Call
Write indicates an expected call of Write.
func (*MockConnMockRecorder) WriteFrame ¶
func (mr *MockConnMockRecorder) WriteFrame(arg0, arg1 interface{}) *gomock.Call
WriteFrame indicates an expected call of WriteFrame.
type MockDialer ¶
type MockDialer struct {
// contains filtered or unexported fields
}
MockDialer is a mock of Dialer interface.
func NewMockDialer ¶
func NewMockDialer(ctrl *gomock.Controller) *MockDialer
NewMockDialer creates a new mock instance.
func (*MockDialer) DialAndHandshake ¶
func (m *MockDialer) DialAndHandshake(arg0 DialerContext) (net.Conn, error)
DialAndHandshake mocks base method.
func (*MockDialer) EXPECT ¶
func (m *MockDialer) EXPECT() *MockDialerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockDialerMockRecorder ¶
type MockDialerMockRecorder struct {
// contains filtered or unexported fields
}
MockDialerMockRecorder is the mock recorder for MockDialer.
func (*MockDialerMockRecorder) DialAndHandshake ¶
func (mr *MockDialerMockRecorder) DialAndHandshake(arg0 interface{}) *gomock.Call
DialAndHandshake indicates an expected call of DialAndHandshake.
type MockDispatcher ¶
type MockDispatcher struct {
// contains filtered or unexported fields
}
MockDispatcher is a mock of Dispatcher interface.
func NewMockDispatcher ¶
func NewMockDispatcher(ctrl *gomock.Controller) *MockDispatcher
NewMockDispatcher creates a new mock instance.
func (*MockDispatcher) EXPECT ¶
func (m *MockDispatcher) EXPECT() *MockDispatcherMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockDispatcherMockRecorder ¶
type MockDispatcherMockRecorder struct {
// contains filtered or unexported fields
}
MockDispatcherMockRecorder is the mock recorder for MockDispatcher.
func (*MockDispatcherMockRecorder) Push ¶
func (mr *MockDispatcherMockRecorder) Push(gateway, channels, p interface{}) *gomock.Call
Push indicates an expected call of Push.
type MockFrame ¶
type MockFrame struct {
// contains filtered or unexported fields
}
MockFrame is a mock of Frame interface.
func NewMockFrame ¶
func NewMockFrame(ctrl *gomock.Controller) *MockFrame
NewMockFrame creates a new mock instance.
func (*MockFrame) EXPECT ¶
func (m *MockFrame) EXPECT() *MockFrameMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockFrame) GetPayload ¶
GetPayload mocks base method.
func (*MockFrame) SetPayload ¶
SetPayload mocks base method.
type MockFrameMockRecorder ¶
type MockFrameMockRecorder struct {
// contains filtered or unexported fields
}
MockFrameMockRecorder is the mock recorder for MockFrame.
func (*MockFrameMockRecorder) GetOpCode ¶
func (mr *MockFrameMockRecorder) GetOpCode() *gomock.Call
GetOpCode indicates an expected call of GetOpCode.
func (*MockFrameMockRecorder) GetPayload ¶
func (mr *MockFrameMockRecorder) GetPayload() *gomock.Call
GetPayload indicates an expected call of GetPayload.
func (*MockFrameMockRecorder) SetOpCode ¶
func (mr *MockFrameMockRecorder) SetOpCode(arg0 interface{}) *gomock.Call
SetOpCode indicates an expected call of SetOpCode.
func (*MockFrameMockRecorder) SetPayload ¶
func (mr *MockFrameMockRecorder) SetPayload(arg0 interface{}) *gomock.Call
SetPayload indicates an expected call of SetPayload.
type MockMessageListener ¶
type MockMessageListener struct {
// contains filtered or unexported fields
}
MockMessageListener is a mock of MessageListener interface.
func NewMockMessageListener ¶
func NewMockMessageListener(ctrl *gomock.Controller) *MockMessageListener
NewMockMessageListener creates a new mock instance.
func (*MockMessageListener) EXPECT ¶
func (m *MockMessageListener) EXPECT() *MockMessageListenerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMessageListener) Receive ¶
func (m *MockMessageListener) Receive(arg0 Agent, arg1 []byte)
Receive mocks base method.
type MockMessageListenerMockRecorder ¶
type MockMessageListenerMockRecorder struct {
// contains filtered or unexported fields
}
MockMessageListenerMockRecorder is the mock recorder for MockMessageListener.
func (*MockMessageListenerMockRecorder) Receive ¶
func (mr *MockMessageListenerMockRecorder) Receive(arg0, arg1 interface{}) *gomock.Call
Receive indicates an expected call of Receive.
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer is a mock of Server interface.
func NewMockServer ¶
func NewMockServer(ctrl *gomock.Controller) *MockServer
NewMockServer creates a new mock instance.
func (*MockServer) EXPECT ¶
func (m *MockServer) EXPECT() *MockServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockServer) GetMeta ¶
func (m *MockServer) GetMeta() map[string]string
GetMeta mocks base method.
func (*MockServer) GetNamespace ¶
func (m *MockServer) GetNamespace() string
GetNamespace mocks base method.
func (*MockServer) GetProtocol ¶
func (m *MockServer) GetProtocol() string
GetProtocol mocks base method.
func (*MockServer) PublicAddress ¶
func (m *MockServer) PublicAddress() string
PublicAddress mocks base method.
func (*MockServer) Push ¶
func (m *MockServer) Push(arg0 string, arg1 []byte) error
Push mocks base method.
func (*MockServer) ServiceName ¶
func (m *MockServer) ServiceName() string
ServiceName mocks base method.
func (*MockServer) SetAcceptor ¶
func (m *MockServer) SetAcceptor(arg0 Acceptor)
SetAcceptor mocks base method.
func (*MockServer) SetChannelMap ¶
func (m *MockServer) SetChannelMap(arg0 ChannelMap)
SetChannelMap mocks base method.
func (*MockServer) SetMessageListener ¶
func (m *MockServer) SetMessageListener(arg0 MessageListener)
SetMessageListener mocks base method.
func (*MockServer) SetReadWait ¶
func (m *MockServer) SetReadWait(arg0 time.Duration)
SetReadWait mocks base method.
func (*MockServer) SetStateListener ¶
func (m *MockServer) SetStateListener(arg0 StateListener)
SetStateListener mocks base method.
type MockServerMockRecorder ¶
type MockServerMockRecorder struct {
// contains filtered or unexported fields
}
MockServerMockRecorder is the mock recorder for MockServer.
func (*MockServerMockRecorder) DialURL ¶
func (mr *MockServerMockRecorder) DialURL() *gomock.Call
DialURL indicates an expected call of DialURL.
func (*MockServerMockRecorder) GetMeta ¶
func (mr *MockServerMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockServerMockRecorder) GetNamespace ¶
func (mr *MockServerMockRecorder) GetNamespace() *gomock.Call
GetNamespace indicates an expected call of GetNamespace.
func (*MockServerMockRecorder) GetProtocol ¶
func (mr *MockServerMockRecorder) GetProtocol() *gomock.Call
GetProtocol indicates an expected call of GetProtocol.
func (*MockServerMockRecorder) GetTags ¶
func (mr *MockServerMockRecorder) GetTags() *gomock.Call
GetTags indicates an expected call of GetTags.
func (*MockServerMockRecorder) PublicAddress ¶
func (mr *MockServerMockRecorder) PublicAddress() *gomock.Call
PublicAddress indicates an expected call of PublicAddress.
func (*MockServerMockRecorder) PublicPort ¶
func (mr *MockServerMockRecorder) PublicPort() *gomock.Call
PublicPort indicates an expected call of PublicPort.
func (*MockServerMockRecorder) Push ¶
func (mr *MockServerMockRecorder) Push(arg0, arg1 interface{}) *gomock.Call
Push indicates an expected call of Push.
func (*MockServerMockRecorder) ServiceID ¶
func (mr *MockServerMockRecorder) ServiceID() *gomock.Call
ServiceID indicates an expected call of ServiceID.
func (*MockServerMockRecorder) ServiceName ¶
func (mr *MockServerMockRecorder) ServiceName() *gomock.Call
ServiceName indicates an expected call of ServiceName.
func (*MockServerMockRecorder) SetAcceptor ¶
func (mr *MockServerMockRecorder) SetAcceptor(arg0 interface{}) *gomock.Call
SetAcceptor indicates an expected call of SetAcceptor.
func (*MockServerMockRecorder) SetChannelMap ¶
func (mr *MockServerMockRecorder) SetChannelMap(arg0 interface{}) *gomock.Call
SetChannelMap indicates an expected call of SetChannelMap.
func (*MockServerMockRecorder) SetMessageListener ¶
func (mr *MockServerMockRecorder) SetMessageListener(arg0 interface{}) *gomock.Call
SetMessageListener indicates an expected call of SetMessageListener.
func (*MockServerMockRecorder) SetReadWait ¶
func (mr *MockServerMockRecorder) SetReadWait(arg0 interface{}) *gomock.Call
SetReadWait indicates an expected call of SetReadWait.
func (*MockServerMockRecorder) SetStateListener ¶
func (mr *MockServerMockRecorder) SetStateListener(arg0 interface{}) *gomock.Call
SetStateListener indicates an expected call of SetStateListener.
func (*MockServerMockRecorder) Shutdown ¶
func (mr *MockServerMockRecorder) Shutdown(arg0 interface{}) *gomock.Call
Shutdown indicates an expected call of Shutdown.
func (*MockServerMockRecorder) Start ¶
func (mr *MockServerMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockServerMockRecorder) String ¶
func (mr *MockServerMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) GetMeta ¶
func (m *MockService) GetMeta() map[string]string
GetMeta mocks base method.
func (*MockService) ServiceID ¶
func (m *MockService) ServiceID() string
ServiceID mocks base method.
func (*MockService) ServiceName ¶
func (m *MockService) ServiceName() string
ServiceName mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) GetMeta ¶
func (mr *MockServiceMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockServiceMockRecorder) ServiceID ¶
func (mr *MockServiceMockRecorder) ServiceID() *gomock.Call
ServiceID indicates an expected call of ServiceID.
func (*MockServiceMockRecorder) ServiceName ¶
func (mr *MockServiceMockRecorder) ServiceName() *gomock.Call
ServiceName indicates an expected call of ServiceName.
type MockServiceRegistration ¶
type MockServiceRegistration struct {
// contains filtered or unexported fields
}
MockServiceRegistration is a mock of ServiceRegistration interface.
func NewMockServiceRegistration ¶
func NewMockServiceRegistration(ctrl *gomock.Controller) *MockServiceRegistration
NewMockServiceRegistration creates a new mock instance.
func (*MockServiceRegistration) DialURL ¶
func (m *MockServiceRegistration) DialURL() string
DialURL mocks base method.
func (*MockServiceRegistration) EXPECT ¶
func (m *MockServiceRegistration) EXPECT() *MockServiceRegistrationMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockServiceRegistration) GetMeta ¶
func (m *MockServiceRegistration) GetMeta() map[string]string
GetMeta mocks base method.
func (*MockServiceRegistration) GetNamespace ¶
func (m *MockServiceRegistration) GetNamespace() string
GetNamespace mocks base method.
func (*MockServiceRegistration) GetProtocol ¶
func (m *MockServiceRegistration) GetProtocol() string
GetProtocol mocks base method.
func (*MockServiceRegistration) GetTags ¶
func (m *MockServiceRegistration) GetTags() []string
GetTags mocks base method.
func (*MockServiceRegistration) PublicAddress ¶
func (m *MockServiceRegistration) PublicAddress() string
PublicAddress mocks base method.
func (*MockServiceRegistration) PublicPort ¶
func (m *MockServiceRegistration) PublicPort() int
PublicPort mocks base method.
func (*MockServiceRegistration) ServiceID ¶
func (m *MockServiceRegistration) ServiceID() string
ServiceID mocks base method.
func (*MockServiceRegistration) ServiceName ¶
func (m *MockServiceRegistration) ServiceName() string
ServiceName mocks base method.
func (*MockServiceRegistration) String ¶
func (m *MockServiceRegistration) String() string
String mocks base method.
type MockServiceRegistrationMockRecorder ¶
type MockServiceRegistrationMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceRegistrationMockRecorder is the mock recorder for MockServiceRegistration.
func (*MockServiceRegistrationMockRecorder) DialURL ¶
func (mr *MockServiceRegistrationMockRecorder) DialURL() *gomock.Call
DialURL indicates an expected call of DialURL.
func (*MockServiceRegistrationMockRecorder) GetMeta ¶
func (mr *MockServiceRegistrationMockRecorder) GetMeta() *gomock.Call
GetMeta indicates an expected call of GetMeta.
func (*MockServiceRegistrationMockRecorder) GetNamespace ¶
func (mr *MockServiceRegistrationMockRecorder) GetNamespace() *gomock.Call
GetNamespace indicates an expected call of GetNamespace.
func (*MockServiceRegistrationMockRecorder) GetProtocol ¶
func (mr *MockServiceRegistrationMockRecorder) GetProtocol() *gomock.Call
GetProtocol indicates an expected call of GetProtocol.
func (*MockServiceRegistrationMockRecorder) GetTags ¶
func (mr *MockServiceRegistrationMockRecorder) GetTags() *gomock.Call
GetTags indicates an expected call of GetTags.
func (*MockServiceRegistrationMockRecorder) PublicAddress ¶
func (mr *MockServiceRegistrationMockRecorder) PublicAddress() *gomock.Call
PublicAddress indicates an expected call of PublicAddress.
func (*MockServiceRegistrationMockRecorder) PublicPort ¶
func (mr *MockServiceRegistrationMockRecorder) PublicPort() *gomock.Call
PublicPort indicates an expected call of PublicPort.
func (*MockServiceRegistrationMockRecorder) ServiceID ¶
func (mr *MockServiceRegistrationMockRecorder) ServiceID() *gomock.Call
ServiceID indicates an expected call of ServiceID.
func (*MockServiceRegistrationMockRecorder) ServiceName ¶
func (mr *MockServiceRegistrationMockRecorder) ServiceName() *gomock.Call
ServiceName indicates an expected call of ServiceName.
func (*MockServiceRegistrationMockRecorder) String ¶
func (mr *MockServiceRegistrationMockRecorder) String() *gomock.Call
String indicates an expected call of String.
type MockSessionStorage ¶
type MockSessionStorage struct {
// contains filtered or unexported fields
}
MockSessionStorage is a mock of SessionStorage interface.
func NewMockSessionStorage ¶
func NewMockSessionStorage(ctrl *gomock.Controller) *MockSessionStorage
NewMockSessionStorage creates a new mock instance.
func (*MockSessionStorage) Add ¶
func (m *MockSessionStorage) Add(session *pkt.Session) error
Add mocks base method.
func (*MockSessionStorage) Delete ¶
func (m *MockSessionStorage) Delete(account, channelId string) error
Delete mocks base method.
func (*MockSessionStorage) EXPECT ¶
func (m *MockSessionStorage) EXPECT() *MockSessionStorageMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSessionStorage) Get ¶
func (m *MockSessionStorage) Get(channelId string) (*pkt.Session, error)
Get mocks base method.
func (*MockSessionStorage) GetLocation ¶
func (m *MockSessionStorage) GetLocation(account, device string) (*Location, error)
GetLocation mocks base method.
func (*MockSessionStorage) GetLocations ¶
func (m *MockSessionStorage) GetLocations(account ...string) ([]*Location, error)
GetLocations mocks base method.
type MockSessionStorageMockRecorder ¶
type MockSessionStorageMockRecorder struct {
// contains filtered or unexported fields
}
MockSessionStorageMockRecorder is the mock recorder for MockSessionStorage.
func (*MockSessionStorageMockRecorder) Add ¶
func (mr *MockSessionStorageMockRecorder) Add(session interface{}) *gomock.Call
Add indicates an expected call of Add.
func (*MockSessionStorageMockRecorder) Delete ¶
func (mr *MockSessionStorageMockRecorder) Delete(account, channelId interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockSessionStorageMockRecorder) Get ¶
func (mr *MockSessionStorageMockRecorder) Get(channelId interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockSessionStorageMockRecorder) GetLocation ¶
func (mr *MockSessionStorageMockRecorder) GetLocation(account, device interface{}) *gomock.Call
GetLocation indicates an expected call of GetLocation.
func (*MockSessionStorageMockRecorder) GetLocations ¶
func (mr *MockSessionStorageMockRecorder) GetLocations(account ...interface{}) *gomock.Call
GetLocations indicates an expected call of GetLocations.
type MockStateListener ¶
type MockStateListener struct {
// contains filtered or unexported fields
}
MockStateListener is a mock of StateListener interface.
func NewMockStateListener ¶
func NewMockStateListener(ctrl *gomock.Controller) *MockStateListener
NewMockStateListener creates a new mock instance.
func (*MockStateListener) Disconnect ¶
func (m *MockStateListener) Disconnect(arg0 string) error
Disconnect mocks base method.
func (*MockStateListener) EXPECT ¶
func (m *MockStateListener) EXPECT() *MockStateListenerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockStateListenerMockRecorder ¶
type MockStateListenerMockRecorder struct {
// contains filtered or unexported fields
}
MockStateListenerMockRecorder is the mock recorder for MockStateListener.
func (*MockStateListenerMockRecorder) Disconnect ¶
func (mr *MockStateListenerMockRecorder) Disconnect(arg0 interface{}) *gomock.Call
Disconnect indicates an expected call of Disconnect.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router defines
func (*Router) Handle ¶
func (r *Router) Handle(command string, handlers ...HandlerFunc)
Handle register a command handler
func (*Router) Serve ¶
func (r *Router) Serve(packet *pkt.LogicPkt, dispatcher Dispatcher, cache SessionStorage, session Session) error
Serve a packet from client
func (*Router) Use ¶
func (r *Router) Use(handlers ...HandlerFunc)
type Server ¶
type Server interface { ServiceRegistration // SetAcceptor 设置Acceptor SetAcceptor(Acceptor) //SetMessageListener 设置上行消息监听器 SetMessageListener(MessageListener) //SetStateListener 设置连接状态监听服务 SetStateListener(StateListener) // SetReadWait 设置读超时 SetReadWait(time.Duration) // SetChannelMap 设置Channel管理服务 SetChannelMap(ChannelMap) // Start 用于在内部实现网络端口的监听和接收连接, // 并完成一个Channel的初始化过程。 Start() error // Push 消息到指定的Channel中 // string channelID // []byte 序列化之后的消息数据 Push(string, []byte) error // Shutdown 服务下线,关闭连接 Shutdown(context.Context) error }
Server 定义了一个tcp/websocket不同协议通用的服务端的接口
type ServerOption ¶
type ServerOption func(*ServerOptions)
func WithConnectionGPool ¶
func WithConnectionGPool(val int) ServerOption
func WithMessageGPool ¶
func WithMessageGPool(val int) ServerOption
type ServerOptions ¶
type ServerOptions struct { Loginwait time.Duration //登录超时 Readwait time.Duration //读超时 Writewait time.Duration //写超时 MessageGPool int ConnectionGPool int }
ServerOptions ServerOptions
type ServiceRegistration ¶
type ServiceRegistration interface { Service PublicAddress() string PublicPort() int DialURL() string GetTags() []string GetProtocol() string GetNamespace() string String() string }
定义服务注册的抽象接口
type Session ¶
type Session interface { GetChannelId() string GetGateId() string GetAccount() string GetRemoteIP() string GetApp() string GetTags() []string }
Session read only
type SessionStorage ¶
type SessionStorage interface { // Add a session Add(session *pkt.Session) error // Delete a session Delete(account string, channelId string) error // Get session by channelId Get(channelId string) (*pkt.Session, error) // Get Locations by accounts GetLocations(account ...string) ([]*Location, error) // Get Location by account and device GetLocation(account string, device string) (*Location, error) }
SessionStorage defined a session storage which provides based functions as save,delete,find a session
type StateListener ¶
StateListener 状态监听器