20 lines
463 B
Go
20 lines
463 B
Go
package ziface
|
|
|
|
import "net"
|
|
|
|
type IConnection interface {
|
|
// Start 启动连接
|
|
Start()
|
|
// Stop 停止连接
|
|
Stop()
|
|
// GetTCPConnection 获取当前连接的 TCP Socket 套接字
|
|
GetTCPConnection() *net.TCPConn
|
|
// GetConnID 获取当前连接 ID
|
|
GetConnID() uint32
|
|
// RemoteAddr 获取远程客户端地址信息
|
|
RemoteAddr() net.Addr
|
|
}
|
|
|
|
// HandleFunc 定义一个统一处理连接业务的方法
|
|
type HandleFunc func(*net.TCPConn, []byte, int) error
|