Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(opts ...ClientOption) network.Client
func NewServer ¶
func NewServer(opts ...ServerOption) network.Server
Types ¶
type ClientOption ¶
type ClientOption func(o *clientOptions)
func WithClientDialAddr ¶
func WithClientDialAddr(addr string) ClientOption
WithClientDialAddr 设置拨号地址
func WithClientDialTimeout ¶
func WithClientDialTimeout(timeout time.Duration) ClientOption
WithClientDialTimeout 设置拨号超时时间
func WithClientHeartbeatInterval ¶
func WithClientHeartbeatInterval(heartbeatInterval time.Duration) ClientOption
WithClientHeartbeatInterval 设置心跳间隔时间
type HeartbeatMechanism ¶
type HeartbeatMechanism string
const ( RespHeartbeat HeartbeatMechanism = "resp" // 响应式心跳 TickHeartbeat HeartbeatMechanism = "tick" // 主动定时心跳 )
type ServerOption ¶
type ServerOption func(o *serverOptions)
func WithServerHeartbeatInterval ¶
func WithServerHeartbeatInterval(heartbeatInterval time.Duration) ServerOption
WithServerHeartbeatInterval 设置心跳检测间隔时间
func WithServerHeartbeatMechanism ¶
func WithServerHeartbeatMechanism(heartbeatMechanism HeartbeatMechanism) ServerOption
WithServerHeartbeatMechanism 设置心跳机制
func WithServerListenAddr ¶
func WithServerListenAddr(addr string) ServerOption
WithServerListenAddr 设置监听地址
func WithServerMaxConnNum ¶
func WithServerMaxConnNum(maxConnNum int) ServerOption
WithServerMaxConnNum 设置连接的最大连接数
Click to show internal directories.
Click to hide internal directories.