tcp

package module
v2.0.0-...-74eeffd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 14 Imported by: 0

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 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 WithServerHeartbeatWithServerTime

func WithServerHeartbeatWithServerTime(heartbeatWithServerTime bool) ServerOption

WithServerHeartbeatWithServerTime 设置下行心跳是否携带服务器时间

func WithServerListenAddr

func WithServerListenAddr(addr string) ServerOption

WithServerListenAddr 设置监听地址

func WithServerMaxConnNum

func WithServerMaxConnNum(maxConnNum int) ServerOption

WithServerMaxConnNum 设置连接的最大连接数

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL