Documentation ¶
Index ¶
- Constants
- func AddInheritedFunc(fn func([]*Listener, map[string]string))
- func DialAddrContext(network string, laddr *net.UDPAddr, raddr string, tlsConf *tls.Config, ...) (net.Conn, error)
- func GetInheritedFunc(fn func() []int)
- func InheritedListen(network, laddr string, tlsConf *tls.Config, dataShards, parityShards int) (net.Listener, error)
- func SetInherited() error
- type Listener
- func Listen(conn net.PacketConn, tlsConf *tls.Config, dataShards, parityShards int) (*Listener, error)
- func ListenAddr(network, addr string, tlsConf *tls.Config, dataShards, parityShards int) (*Listener, error)
- func ListenUDPAddr(network string, udpAddr *net.UDPAddr, tlsConf *tls.Config, ...) (*Listener, error)
- type UDPSession
Constants ¶
View Source
const ( DefaultDataShards = 10 //FEC前向纠错算法的数据冗余度 DefaultParityShards = 3 ////FEC前向纠错算法的奇偶校验配置 )
kcp 协议的配置
Variables ¶
This section is empty.
Functions ¶
func AddInheritedFunc ¶
AddInheritedFunc 平滑重启的时候,会回调该方法,保存fd列表
func DialAddrContext ¶
func GetInheritedFunc ¶
func GetInheritedFunc(fn func() []int)
GetInheritedFunc 如果是平滑重启,可以获取到从父进程继承过来的fd列表
func InheritedListen ¶
func InheritedListen(network, laddr string, tlsConf *tls.Config, dataShards, parityShards int) (net.Listener, error)
InheritedListen 使用kcp协议启动监听,需要先判断是否是继承过来的端口 network: 网络类型,在这里只能是udp协议,但是区分udp,udp4,udp6 laddr: 本地要监听的数据包地址端口 tlsConf: 证书信息 dataShards,parityShards: FEC前向纠错算法的数据冗余度配置,这两个参数决定了fec的冗余度,冗余度越大抗丢包性就越强。
func SetInherited ¶
func SetInherited() error
SetInherited 添加files列表到环境变量,让子进程继承, 1. 只有在reboot使用 2. 不支持windows系统
Types ¶
type Listener ¶
type Listener struct { *kcp.Listener // contains filtered or unexported fields }
func ListenAddr ¶
func ListenUDPAddr ¶
func (*Listener) PacketConn ¶
func (that *Listener) PacketConn() net.PacketConn
type UDPSession ¶
type UDPSession = kcp.UDPSession
UDPSession defines a KCP session implemented by UDP
Click to show internal directories.
Click to hide internal directories.