tcp

package module
v2.0.0-...-8e761e8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 15 Imported by: 4

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 WithClientAddr

func WithClientAddr(addr string) ClientOption

WithClientAddr 设置拨号地址

func WithClientCredentials

func WithClientCredentials(caFile string, serverName string) ClientOption

WithClientCredentials 设置CA证书和校验域名

func WithClientHeartbeatInterval

func WithClientHeartbeatInterval(heartbeatInterval time.Duration) ClientOption

WithClientHeartbeatInterval 设置心跳间隔时间

func WithClientTimeout

func WithClientTimeout(timeout time.Duration) ClientOption

WithClientTimeout 设置拨号超时时间

type HeartbeatMechanism

type HeartbeatMechanism string
const (
	RespHeartbeat HeartbeatMechanism = "resp" // 响应式心跳
	TickHeartbeat HeartbeatMechanism = "tick" // 主动定时心跳
)

type ServerOption

type ServerOption func(o *serverOptions)

func WithServerAuthorizeTimeout

func WithServerAuthorizeTimeout(authorizeTimeout time.Duration) ServerOption

WithServerAuthorizeTimeout 设置授权超时时间

func WithServerCredentials

func WithServerCredentials(certFile, keyFile string) ServerOption

WithServerCredentials 设置服务器证书和秘钥

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 设置连接的最大连接数

Jump to

Keyboard shortcuts

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