tcp

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: LGPL-2.1 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Install = definePlugin.Install

Install 安装插件

View Source
var Uninstall = definePlugin.Uninstall

Uninstall 卸载插件

Functions

This section is empty.

Types

type ClientAuthHandler

type ClientAuthHandler = func(conn net.Conn, token string, extensions []byte) error // 客户端鉴权鉴权处理器

type GateOption

type GateOption func(options *GateOptions)

type GateOptions

type GateOptions struct {
	Endpoints                      []string                     // 所有监听地址
	TLSConfig                      *tls.Config                  // TLS配置,nil表示不使用TLS加密链路
	TCPNoDelay                     *bool                        // TCP的NoDelay选项,nil表示使用系统默认值
	TCPQuickAck                    *bool                        // TCP的QuickAck选项,nil表示使用系统默认值
	TCPRecvBuf                     *int                         // TCP的RecvBuf大小(字节)选项,nil表示使用系统默认值
	TCPSendBuf                     *int                         // TCP的SendBuf大小(字节)选项,nil表示使用系统默认值
	TCPLinger                      *int                         // TCP的PLinger选项,nil表示使用系统默认值
	IOTimeout                      time.Duration                // 网络io超时时间
	IORetryTimes                   int                          // 网络io超时后的重试次数
	IOSequencedBuffCap             int                          // 网络io时序缓存容量(字节)
	DecoderMsgCreator              codec.IMsgCreator            // 消息包解码器的消息构建器
	AgreeClientEncryptionProposal  bool                         // 是否同意使用客户端建议的加密方案
	EncCipherSuite                 transport.CipherSuite        // 加密通信中的密码学套件
	EncNonceStep                   *big.Int                     // 加密通信中,使用需要nonce的加密算法时,每次加解密自增值
	EncECDHENamedCurve             transport.NamedCurve         // 加密通信中,在ECDHE交换秘钥时使用的曲线类型
	EncSignatureAlgorithm          transport.SignatureAlgorithm // 加密通信中的签名算法
	EncSignaturePrivateKey         crypto.PrivateKey            // 加密通信中,签名用的私钥
	EncVerifyClientSignature       bool                         // 加密通信中,是否验证客户端签名
	EncVerifySignaturePublicKey    crypto.PublicKey             // 加密通信中,验证客户端签名用的公钥
	AgreeClientCompressionProposal bool                         // 是否同意使用客户端建议的压缩方案
	Compression                    transport.Compression        // 通信中的压缩函数
	CompressedSize                 int                          // 通信中启用压缩阀值(字节),<=0表示不开启
	SessionInactiveTimeout         time.Duration                // 会话不活跃后的超时时间
	ClientAuthHandlers             []ClientAuthHandler          // 客户端鉴权鉴权处理器列表
	SessionStateChangedHandlers    []SessionStateChangedHandler // 会话状态变化的处理器列表(优先级高于会话的处理器)
	SessionRecvDataHandlers        []SessionRecvDataHandler     // 会话接收的数据的处理器列表(优先级高于会话的处理器)
	SessionRecvEventHandlers       []SessionRecvEventHandler    // 会话接收的自定义事件的处理器列表(优先级高于会话的处理器)
}

type SessionRecvDataHandler

type SessionRecvDataHandler = gate.RecvDataHandler // 会话接收的数据的处理器

type SessionRecvEventHandler

type SessionRecvEventHandler = gate.RecvEventHandler // 会话接收的自定义事件的处理器

type SessionStateChangedHandler

type SessionStateChangedHandler = gate.StateChangedHandler // 会话状态变化的处理器

type WithOption

type WithOption struct{}

func (WithOption) AgreeClientCompressionProposal

func (WithOption) AgreeClientCompressionProposal(b bool) GateOption

func (WithOption) AgreeClientEncryptionProposal

func (WithOption) AgreeClientEncryptionProposal(b bool) GateOption

func (WithOption) ClientAuthHandlers

func (WithOption) ClientAuthHandlers(handlers []ClientAuthHandler) GateOption

func (WithOption) CompressedSize

func (WithOption) CompressedSize(size int) GateOption

func (WithOption) Compression

func (WithOption) Compression(c transport.Compression) GateOption

func (WithOption) DecoderMsgCreator

func (WithOption) DecoderMsgCreator(mc codec.IMsgCreator) GateOption

func (WithOption) Default

func (WithOption) Default() GateOption

func (WithOption) EncCipherSuite

func (WithOption) EncCipherSuite(cs transport.CipherSuite) GateOption

func (WithOption) EncECDHENamedCurve

func (WithOption) EncECDHENamedCurve(nc transport.NamedCurve) GateOption

func (WithOption) EncNonceStep

func (WithOption) EncNonceStep(v *big.Int) GateOption

func (WithOption) EncSignatureAlgorithm

func (WithOption) EncSignatureAlgorithm(sa transport.SignatureAlgorithm) GateOption

func (WithOption) EncSignaturePrivateKey

func (WithOption) EncSignaturePrivateKey(priv crypto.PrivateKey) GateOption

func (WithOption) EncVerifyClientSignature

func (WithOption) EncVerifyClientSignature(b bool) GateOption

func (WithOption) EncVerifySignaturePublicKey

func (WithOption) EncVerifySignaturePublicKey(pub crypto.PublicKey) GateOption

func (WithOption) Endpoints

func (WithOption) Endpoints(endpoints ...string) GateOption

func (WithOption) IORetryTimes

func (WithOption) IORetryTimes(times int) GateOption

func (WithOption) IOSequencedBuffCap

func (WithOption) IOSequencedBuffCap(cap int) GateOption

func (WithOption) IOTimeout

func (WithOption) IOTimeout(d time.Duration) GateOption

func (WithOption) SessionInactiveTimeout

func (WithOption) SessionInactiveTimeout(d time.Duration) GateOption

func (WithOption) SessionRecvDataHandlers

func (WithOption) SessionRecvDataHandlers(handlers []SessionRecvDataHandler) GateOption

func (WithOption) SessionRecvEventHandlers

func (WithOption) SessionRecvEventHandlers(handlers ...SessionRecvEventHandler) GateOption

func (WithOption) SessionStateChangedHandlers

func (WithOption) SessionStateChangedHandlers(handlers []SessionStateChangedHandler) GateOption

func (WithOption) TCPLinger

func (WithOption) TCPLinger(sec *int) GateOption

func (WithOption) TCPNoDelay

func (WithOption) TCPNoDelay(b *bool) GateOption

func (WithOption) TCPQuickAck

func (WithOption) TCPQuickAck(b *bool) GateOption

func (WithOption) TCPRecvBuf

func (WithOption) TCPRecvBuf(size *int) GateOption

func (WithOption) TCPSendBuf

func (WithOption) TCPSendBuf(size *int) GateOption

func (WithOption) TLSConfig

func (WithOption) TLSConfig(tlsConfig *tls.Config) GateOption

Jump to

Keyboard shortcuts

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