Versions in this module Expand all Collapse all v1 v1.24.4 Aug 19, 2016 Changes in this version + const DataSegmentOverhead + const DistroSize + const NumDistro + var ErrClosedConnection = errors.New("Connection closed.") + var ErrClosedListener = errors.New("Listener closed.") + var ErrIOTimeout = errors.New("Read/Write timeout") + func AllocateBuffer() *alloc.Buffer + func DialKCP(src v2net.Address, dest v2net.Destination) (internet.Connection, error) + func ListenKCP(address v2net.Address, port v2net.Port) (internet.Listener, error) + func NewSimpleAuthenticator() internet.Authenticator + type AckList struct + func NewAckList(writer SegmentWriter) *AckList + func (this *AckList) Add(number uint32, timestamp uint32) + func (this *AckList) Clear(una uint32) + func (this *AckList) Flush(current uint32, rto uint32) + type AckSegment struct + Conv uint16 + Count byte + NumberList []uint32 + Option SegmentOption + ReceivingNext uint32 + ReceivingWindow uint32 + Timestamp uint32 + func NewAckSegment() *AckSegment + func (this *AckSegment) ByteSize() int + func (this *AckSegment) Bytes(b []byte) []byte + func (this *AckSegment) IsFull() bool + func (this *AckSegment) PutNumber(number uint32) + func (this *AckSegment) PutTimestamp(timestamp uint32) + func (this *AckSegment) Release() + type AuthenticationWriter struct + Authenticator internet.Authenticator + Writer io.Writer + func (this *AuthenticationWriter) Mtu() uint32 + func (this *AuthenticationWriter) Release() + func (this *AuthenticationWriter) Write(payload *alloc.Buffer) error + type Buffer struct + func NewBuffer() *Buffer + func (this *Buffer) Allocate() *alloc.Buffer + func (this *Buffer) Free(b *alloc.Buffer) + func (this *Buffer) IsEmpty() bool + func (this *Buffer) Release() + func (this *Buffer) ReleaseBuffer() + type BufferedSegmentWriter struct + func NewSegmentWriter(writer *AuthenticationWriter) *BufferedSegmentWriter + func (this *BufferedSegmentWriter) Flush() + func (this *BufferedSegmentWriter) FlushWithoutLock() + func (this *BufferedSegmentWriter) Write(seg Segment) + type CmdOnlySegment struct + Command Command + Conv uint16 + Option SegmentOption + PeerRTO uint32 + ReceivinNext uint32 + SendingNext uint32 + func NewCmdOnlySegment() *CmdOnlySegment + func (this *CmdOnlySegment) ByteSize() int + func (this *CmdOnlySegment) Bytes(b []byte) []byte + func (this *CmdOnlySegment) Release() + type Command byte + const CommandACK + const CommandData + const CommandPing + const CommandTerminate + type Config struct + Congestion bool + DownlinkCapacity uint32 + HeaderConfig internet.AuthenticatorConfig + HeaderType string + Mtu uint32 + ReadBuffer uint32 + Tti uint32 + UplinkCapacity uint32 + WriteBuffer uint32 + func DefaultConfig() Config + func (this *Config) Apply() + func (this *Config) GetAuthenticator() (internet.Authenticator, error) + func (this *Config) GetReceivingQueueSize() uint32 + func (this *Config) GetReceivingWindowSize() uint32 + func (this *Config) GetSendingInFlightSize() uint32 + func (this *Config) GetSendingQueueSize() uint32 + func (this *Config) GetSendingWindowSize() uint32 + type Connection struct + func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr, ...) *Connection + func (this *Connection) Close() error + func (this *Connection) Elapsed() uint32 + func (this *Connection) FetchInputFrom(conn io.Reader) + func (this *Connection) HandleOption(opt SegmentOption) + func (this *Connection) Input(data []byte) int + func (this *Connection) LocalAddr() net.Addr + func (this *Connection) OnPeerClosed() + func (this *Connection) Read(b []byte) (int, error) + func (this *Connection) RemoteAddr() net.Addr + func (this *Connection) Reusable() bool + func (this *Connection) SetDeadline(t time.Time) error + func (this *Connection) SetReadDeadline(t time.Time) error + func (this *Connection) SetReusable(b bool) + func (this *Connection) SetState(state State) + func (this *Connection) SetWriteDeadline(t time.Time) error + func (this *Connection) State() State + func (this *Connection) Terminate() + func (this *Connection) Write(b []byte) (int, error) + type DataSegment struct + Conv uint16 + Data *alloc.Buffer + Number uint32 + Option SegmentOption + SendingNext uint32 + Timestamp uint32 + func NewDataSegment() *DataSegment + func (this *DataSegment) ByteSize() int + func (this *DataSegment) Bytes(b []byte) []byte + func (this *DataSegment) Release() + type Listener struct + func NewListener(address v2net.Address, port v2net.Port) (*Listener, error) + func (this *Listener) Accept() (internet.Connection, error) + func (this *Listener) ActiveConnections() int + func (this *Listener) Addr() net.Addr + func (this *Listener) Close() error + func (this *Listener) OnReceive(payload *alloc.Buffer, session *proxy.SessionInfo) + func (this *Listener) Remove(dest string) + type ReceivingQueue struct + func NewReceivingQueue(size uint32) *ReceivingQueue + func (this *ReceivingQueue) Close() + func (this *ReceivingQueue) IsEmpty() bool + func (this *ReceivingQueue) IsFull() bool + func (this *ReceivingQueue) Put(payload *alloc.Buffer) + func (this *ReceivingQueue) Read(buf []byte) int + type ReceivingWindow struct + func NewReceivingWindow(size uint32) *ReceivingWindow + func (this *ReceivingWindow) Advance() + func (this *ReceivingWindow) Position(idx uint32) uint32 + func (this *ReceivingWindow) Remove(idx uint32) *DataSegment + func (this *ReceivingWindow) RemoveFirst() *DataSegment + func (this *ReceivingWindow) Set(idx uint32, value *DataSegment) bool + func (this *ReceivingWindow) Size() uint32 + type ReceivingWorker struct + func NewReceivingWorker(kcp *Connection) *ReceivingWorker + func (this *ReceivingWorker) CloseRead() + func (this *ReceivingWorker) Flush(current uint32) + func (this *ReceivingWorker) MarkPingNecessary(b bool) + func (this *ReceivingWorker) PingNecessary() bool + func (this *ReceivingWorker) ProcessSegment(seg *DataSegment) + func (this *ReceivingWorker) ProcessSendingNext(number uint32) + func (this *ReceivingWorker) Read(b []byte) int + func (this *ReceivingWorker) Write(seg Segment) + type RoundTripInfo struct + func (this *RoundTripInfo) SmoothedTime() uint32 + func (this *RoundTripInfo) Timeout() uint32 + func (this *RoundTripInfo) Update(rtt uint32, current uint32) + func (this *RoundTripInfo) UpdatePeerRTO(rto uint32, current uint32) + type Segment interface + ByteSize func() int + Bytes func([]byte) []byte + func ReadSegment(buf []byte) (Segment, []byte) + type SegmentOption byte + const SegmentOptionClose + type SegmentWriter interface + Write func(seg Segment) + type SendingQueue struct + func NewSendingQueue(size uint32) *SendingQueue + func (this *SendingQueue) Clear() + func (this *SendingQueue) IsEmpty() bool + func (this *SendingQueue) IsFull() bool + func (this *SendingQueue) Last() *alloc.Buffer + func (this *SendingQueue) Len() uint32 + func (this *SendingQueue) Pop() *alloc.Buffer + func (this *SendingQueue) Push(seg *alloc.Buffer) + type SendingWindow struct + func NewSendingWindow(size uint32, writer SegmentWriter, onPacketLoss func(uint32)) *SendingWindow + func (this *SendingWindow) Clear(una uint32) + func (this *SendingWindow) First() *DataSegment + func (this *SendingWindow) Flush(current uint32, resend uint32, rto uint32, maxInFlightSize uint32) + func (this *SendingWindow) HandleFastAck(number uint32) + func (this *SendingWindow) IsEmpty() bool + func (this *SendingWindow) IsFull() bool + func (this *SendingWindow) Len() int + func (this *SendingWindow) Push(seg *DataSegment) + func (this *SendingWindow) Remove(idx uint32) + func (this *SendingWindow) Size() uint32 + type SendingWorker struct + func NewSendingWorker(kcp *Connection) *SendingWorker + func (this *SendingWorker) CloseWrite() + func (this *SendingWorker) FillWindow(current uint32) + func (this *SendingWorker) FindFirstUnacknowledged() + func (this *SendingWorker) Flush(current uint32) + func (this *SendingWorker) IsEmpty() bool + func (this *SendingWorker) MarkPingNecessary(b bool) + func (this *SendingWorker) OnPacketLoss(lossRate uint32) + func (this *SendingWorker) PingNecessary() bool + func (this *SendingWorker) ProcessAck(number uint32) + func (this *SendingWorker) ProcessReceivingNext(nextNumber uint32) + func (this *SendingWorker) ProcessReceivingNextWithoutLock(nextNumber uint32) + func (this *SendingWorker) ProcessSegment(current uint32, seg *AckSegment) + func (this *SendingWorker) Push(b []byte) int + func (this *SendingWorker) Write(seg Segment) + type SimpleAuthenticator struct + func (this *SimpleAuthenticator) Open(buffer *alloc.Buffer) bool + func (this *SimpleAuthenticator) Overhead() int + func (this *SimpleAuthenticator) Seal(buffer *alloc.Buffer) + type State int32 + const StateActive + const StatePeerClosed + const StatePeerTerminating + const StateReadyToClose + const StateTerminated + const StateTerminating + func (this State) Is(states ...State) bool + type Writer struct + func (this *Writer) Close() error + func (this *Writer) Write(payload []byte) (int, error) Incompatible versions in this module v3.50.2+incompatible Oct 29, 2018