Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConnectionReset = errors.New("connection reset by peer") ErrReadConnectionReset = errors.New("read: connection reset by peer") )
View Source
var (
ErrIncompletePacket = errors.New("incomplete packet")
)
Functions ¶
func NewServer ¶
func NewServer(opts ...ServerOption) network.Server
Types ¶
type ServerOption ¶
type ServerOption func(o *serverOptions)
func WithServerEnableHeartbeatCheck ¶
func WithServerEnableHeartbeatCheck(enable bool) ServerOption
WithServerEnableHeartbeatCheck 是否启用心跳检测
func WithServerHeartbeatInterval ¶
func WithServerHeartbeatInterval(heartbeatInterval time.Duration) ServerOption
WithServerHeartbeatInterval 设置心跳检测间隔时间
func WithServerListenAddr ¶
func WithServerListenAddr(addr string) ServerOption
WithServerListenAddr 设置监听地址
func WithServerMaxMsgLen ¶
func WithServerMaxMsgLen(maxMsgLen int) ServerOption
WithServerMaxMsgLen 设置消息最大长度
func WithServerMulticore ¶
func WithServerMulticore(multicore bool) ServerOption
WithServerMulticore 设置心跳检测间隔时间
Click to show internal directories.
Click to hide internal directories.