Documentation
¶
Index ¶
- func RequestAuth(conn net.Conn, identity protocol.Identity, pwd string) (*protocol.Procotol, error)
- func ResponseAuth(conn net.Conn, identity protocol.Identity, pwd string) (*protocol.Procotol, error)
- type CommandHandler
- type Conn
- type GatewayConn
- func (own GatewayConn) Auth(pwd string) (err error)
- func (own GatewayConn) GetLastRecvPacket() *protocol.Procotol
- func (own GatewayConn) GetLastSendPacket() *protocol.Procotol
- func (own GatewayConn) GetMetadata() *metadata
- func (own GatewayConn) IsClosed() bool
- func (own GatewayConn) Recv() (*protocol.Procotol, error)
- func (own GatewayConn) Send(cmd protocol.Command, data any) error
- func (own GatewayConn) Unregister() error
- func (own GatewayConn) WithHeart(itv int)
- type InstanceConn
- func (own InstanceConn) Auth(pwd string) (err error)
- func (own InstanceConn) GetLastRecvPacket() *protocol.Procotol
- func (own InstanceConn) GetLastSendPacket() *protocol.Procotol
- func (own InstanceConn) GetMetadata() *metadata
- func (own InstanceConn) IsClosed() bool
- func (own InstanceConn) Recv() (*protocol.Procotol, error)
- func (own *InstanceConn) Register(ins *model.Instance) error
- func (own InstanceConn) Send(cmd protocol.Command, data any) error
- func (own InstanceConn) Unregister() error
- func (own InstanceConn) WithHeart(itv int)
- type RegistrarConn
- func (own RegistrarConn) Auth(pwd string) (err error)
- func (own RegistrarConn) GetLastRecvPacket() *protocol.Procotol
- func (own RegistrarConn) GetLastSendPacket() *protocol.Procotol
- func (own RegistrarConn) GetMetadata() *metadata
- func (own RegistrarConn) IsClosed() bool
- func (own RegistrarConn) Recv() (*protocol.Procotol, error)
- func (own RegistrarConn) Send(cmd protocol.Command, data any) error
- func (own RegistrarConn) Unregister() error
- func (own RegistrarConn) WithHeart(itv int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestAuth ¶
RequestAuth 请求认证
Types ¶
type CommandHandler ¶
type Conn ¶
type Conn interface {
// 认证连接
Auth(pwd string) error
// 启动心跳
WithHeart(itv int)
// 注销连接
Unregister() error
// 接收协议包
Recv() (*protocol.Procotol, error)
// 发送协议包
Send(cmd protocol.Command, data any) error
// 检查连接是否关闭
IsClosed() bool
// 获取连接的元数据
GetMetadata() *metadata
// 获取最后发送的数据包
GetLastSendPacket() *protocol.Procotol
// 获取最后接收的数据包
GetLastRecvPacket() *protocol.Procotol
}
type GatewayConn ¶
type GatewayConn struct {
// contains filtered or unexported fields
}
func NewGatewayConn ¶
func NewGatewayConn(conn net.Conn, heartbeatInterval int) *GatewayConn
func (GatewayConn) GetLastRecvPacket ¶
func (GatewayConn) GetLastSendPacket ¶
func (GatewayConn) GetMetadata ¶
func (own GatewayConn) GetMetadata() *metadata
func (GatewayConn) Unregister ¶
func (own GatewayConn) Unregister() error
type InstanceConn ¶
type InstanceConn struct {
// contains filtered or unexported fields
}
func NewInstanceConn ¶
func NewInstanceConn(conn net.Conn, heartbeatInterval int) *InstanceConn
func (InstanceConn) GetLastRecvPacket ¶
func (InstanceConn) GetLastSendPacket ¶
func (InstanceConn) GetMetadata ¶
func (own InstanceConn) GetMetadata() *metadata
func (InstanceConn) Unregister ¶
func (own InstanceConn) Unregister() error
type RegistrarConn ¶
type RegistrarConn struct {
// contains filtered or unexported fields
}
func NewRegistrarConn ¶
func NewRegistrarConn(conn net.Conn, heartbeatInterval int) *RegistrarConn
func (RegistrarConn) GetLastRecvPacket ¶
func (RegistrarConn) GetLastSendPacket ¶
func (RegistrarConn) GetMetadata ¶
func (own RegistrarConn) GetMetadata() *metadata
func (RegistrarConn) Unregister ¶
func (own RegistrarConn) Unregister() error
Click to show internal directories.
Click to hide internal directories.