Documentation
¶
Index ¶
- type Remote
- func (p *Remote) GetDisconnectReason() xnetcommon.DisconnectReason
- func (p *Remote) GetIP() string
- func (p *Remote) IsConnect() bool
- func (p *Remote) Send(packet xpacket.IPacket) error
- func (p *Remote) SetDisconnectReason(reason xnetcommon.DisconnectReason)
- func (p *Remote) Start(connOptions *xnetcommon.ConnOptions, event xnetcommon.IEvent, ...)
- func (p *Remote) Stop()
- type Server
- type ServerOptions
- func (p *ServerOptions) WithAckNoDelay(ackNoDelay bool) *ServerOptions
- func (p *ServerOptions) WithBlockCrypt(blockCrypt kcp.BlockCrypt) *ServerOptions
- func (p *ServerOptions) WithEventChan(eventChan chan<- interface{}) *ServerOptions
- func (p *ServerOptions) WithFEC(fec bool) *ServerOptions
- func (p *ServerOptions) WithListenAddress(listenAddress string) *ServerOptions
- func (p *ServerOptions) WithMTUBytes(size int) *ServerOptions
- func (p *ServerOptions) WithReadBuffer(readBuffer int) *ServerOptions
- func (p *ServerOptions) WithSendChanCapacity(sendChanCapacity uint32) *ServerOptions
- func (p *ServerOptions) WithWindowSize(size int) *ServerOptions
- func (p *ServerOptions) WithWriteBuffer(writeBuffer int) *ServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Remote ¶
type Remote struct { UDPSession *kcp.UDPSession Object interface{} // 保存 应用层数据 DisconnectReason xnetcommon.DisconnectReason // 断开原因 // contains filtered or unexported fields }
Remote 远端信息
func (*Remote) GetDisconnectReason ¶
func (p *Remote) GetDisconnectReason() xnetcommon.DisconnectReason
func (*Remote) SetDisconnectReason ¶
func (p *Remote) SetDisconnectReason(reason xnetcommon.DisconnectReason)
func (*Remote) Start ¶
func (p *Remote) Start(connOptions *xnetcommon.ConnOptions, event xnetcommon.IEvent, handler xnetcommon.IHandler)
开始
type Server ¶
type Server struct { IEvent xnetcommon.IEvent IHandler xnetcommon.IHandler // contains filtered or unexported fields }
Server 服务端
type ServerOptions ¶
type ServerOptions struct {
// contains filtered or unexported fields
}
ServerOptions contains options to serverConfigure a Server instance. Each option can be set through setter functions. See documentation for each setter function for an explanation of the option. TODO 修改源码中 minrto 为10ms
func (*ServerOptions) WithAckNoDelay ¶
func (p *ServerOptions) WithAckNoDelay(ackNoDelay bool) *ServerOptions
func (*ServerOptions) WithBlockCrypt ¶
func (p *ServerOptions) WithBlockCrypt(blockCrypt kcp.BlockCrypt) *ServerOptions
func (*ServerOptions) WithEventChan ¶
func (p *ServerOptions) WithEventChan(eventChan chan<- interface{}) *ServerOptions
func (*ServerOptions) WithFEC ¶
func (p *ServerOptions) WithFEC(fec bool) *ServerOptions
func (*ServerOptions) WithListenAddress ¶
func (p *ServerOptions) WithListenAddress(listenAddress string) *ServerOptions
func (*ServerOptions) WithMTUBytes ¶
func (p *ServerOptions) WithMTUBytes(size int) *ServerOptions
func (*ServerOptions) WithReadBuffer ¶
func (p *ServerOptions) WithReadBuffer(readBuffer int) *ServerOptions
func (*ServerOptions) WithSendChanCapacity ¶
func (p *ServerOptions) WithSendChanCapacity(sendChanCapacity uint32) *ServerOptions
func (*ServerOptions) WithWindowSize ¶
func (p *ServerOptions) WithWindowSize(size int) *ServerOptions
func (*ServerOptions) WithWriteBuffer ¶
func (p *ServerOptions) WithWriteBuffer(writeBuffer int) *ServerOptions
Click to show internal directories.
Click to hide internal directories.