Documentation ¶
Overview ¶
Package kcp is a generated protocol buffer package.
It is generated from these files:
v2ray.com/core/transport/internet/kcp/config.proto
It has these top-level messages:
MTU TTI UplinkCapacity DownlinkCapacity WriteBuffer ReadBuffer ConnectionReuse Config
Package kcp - A Fast and Reliable ARQ Protocol ¶
Acknowledgement:
skywind3000@github for inventing the KCP protocol xtaci@github for translating to Golang
Index ¶
- Constants
- Variables
- func DialKCP(src v2net.Address, dest v2net.Destination, options internet.DialerOptions) (internet.Connection, error)
- func ListenKCP(address v2net.Address, port v2net.Port, options internet.ListenOptions) (internet.Listener, error)
- func NewSimpleAuthenticator() cipher.AEAD
- type AckList
- type AckSegment
- func (v *AckSegment) ByteSize() int
- func (v *AckSegment) Bytes() buf.Supplier
- func (v *AckSegment) Command() Command
- func (v *AckSegment) Conversation() uint16
- func (v *AckSegment) IsFull() bool
- func (v *AckSegment) PutNumber(number uint32)
- func (v *AckSegment) PutTimestamp(timestamp uint32)
- func (v *AckSegment) Release()
- type BufferedSegmentWriter
- type ClientConnection
- func (o *ClientConnection) Close() error
- func (o *ClientConnection) Id() internal.ConnectionId
- func (o *ClientConnection) Overhead() int
- func (o *ClientConnection) Read([]byte) (int, error)
- func (o *ClientConnection) Reset(inputCallback func([]Segment))
- func (o *ClientConnection) ResetSecurity(header internet.PacketHeader, security cipher.AEAD)
- func (o *ClientConnection) Run()
- func (o *ClientConnection) Write(b []byte) (int, error)
- type CmdOnlySegment
- type Command
- type Config
- func (*Config) Descriptor() ([]byte, []int)
- func (m *Config) GetConnectionReuse() *ConnectionReuse
- func (m *Config) GetDownlinkCapacity() *DownlinkCapacity
- func (m *Config) GetHeaderConfig() *v2ray_core_common_loader.TypedSettings
- func (m *Config) GetMtu() *MTU
- func (v *Config) GetPackerHeader() (internet.PacketHeader, error)
- func (m *Config) GetReadBuffer() *ReadBuffer
- func (v *Config) GetReceivingBufferSize() uint32
- func (v *Config) GetReceivingInFlightSize() uint32
- func (v *Config) GetSecurity() (cipher.AEAD, error)
- func (v *Config) GetSendingBufferSize() uint32
- func (v *Config) GetSendingInFlightSize() uint32
- func (m *Config) GetTti() *TTI
- func (m *Config) GetUplinkCapacity() *UplinkCapacity
- func (m *Config) GetWriteBuffer() *WriteBuffer
- func (*Config) ProtoMessage()
- func (m *Config) Reset()
- func (m *Config) String() string
- type Connection
- func (v *Connection) Close() error
- func (v *Connection) Elapsed() uint32
- func (v *Connection) HandleOption(opt SegmentOption)
- func (v *Connection) Input(segments []Segment)
- func (v *Connection) LocalAddr() net.Addr
- func (v *Connection) OnDataInput()
- func (v *Connection) OnDataOutput()
- func (v *Connection) OnPeerClosed()
- func (v *Connection) Ping(current uint32, cmd Command)
- func (v *Connection) Read(b []byte) (int, error)
- func (v *Connection) RemoteAddr() net.Addr
- func (v *Connection) Reusable() bool
- func (v *Connection) SetDeadline(t time.Time) error
- func (v *Connection) SetReadDeadline(t time.Time) error
- func (v *Connection) SetReusable(b bool)
- func (v *Connection) SetState(state State)
- func (v *Connection) SetWriteDeadline(t time.Time) error
- func (v *Connection) State() State
- func (v *Connection) Terminate()
- func (v *Connection) Write(b []byte) (int, error)
- type ConnectionId
- type ConnectionReuse
- type DataSegment
- type DownlinkCapacity
- type KCPPacketReader
- type KCPPacketWriter
- type Listener
- func (v *Listener) Accept() (internet.Connection, error)
- func (v *Listener) ActiveConnections() int
- func (v *Listener) Addr() net.Addr
- func (v *Listener) Close() error
- func (v *Listener) OnReceive(payload *buf.Buffer, session *proxy.SessionInfo)
- func (v *Listener) Put(internal.ConnectionId, net.Conn)
- func (v *Listener) Remove(id ConnectionId)
- type MTU
- type PacketReader
- type PacketWriter
- type ReadBuffer
- type ReceivingWindow
- func (v *ReceivingWindow) Advance()
- func (v *ReceivingWindow) Position(idx uint32) uint32
- func (v *ReceivingWindow) Remove(idx uint32) *DataSegment
- func (v *ReceivingWindow) RemoveFirst() *DataSegment
- func (v *ReceivingWindow) Set(idx uint32, value *DataSegment) bool
- func (v *ReceivingWindow) Size() uint32
- type ReceivingWorker
- func (v *ReceivingWorker) CloseRead()
- func (v *ReceivingWorker) Flush(current uint32)
- func (v *ReceivingWorker) ProcessSegment(seg *DataSegment)
- func (v *ReceivingWorker) ProcessSendingNext(number uint32)
- func (v *ReceivingWorker) Read(b []byte) int
- func (v *ReceivingWorker) Release()
- func (v *ReceivingWorker) UpdateNecessary() bool
- func (v *ReceivingWorker) Write(seg Segment)
- type RoundTripInfo
- type Segment
- type SegmentOption
- type SegmentWriter
- type SendingWindow
- func (v *SendingWindow) Clear(una uint32)
- func (v *SendingWindow) FirstNumber() uint32
- func (v *SendingWindow) Flush(current uint32, rto uint32, maxInFlightSize uint32)
- func (v *SendingWindow) HandleFastAck(number uint32, rto uint32)
- func (v *SendingWindow) IsEmpty() bool
- func (v *SendingWindow) IsFull() bool
- func (v *SendingWindow) Len() int
- func (v *SendingWindow) Push(number uint32, data []byte)
- func (v *SendingWindow) Release()
- func (v *SendingWindow) Remove(idx uint32) bool
- func (v *SendingWindow) Size() uint32
- func (v *SendingWindow) Visit(visitor func(seg *DataSegment) bool)
- type SendingWorker
- func (v *SendingWorker) CloseWrite()
- func (v *SendingWorker) FindFirstUnacknowledged()
- func (v *SendingWorker) Flush(current uint32)
- func (v *SendingWorker) IsEmpty() bool
- func (v *SendingWorker) OnPacketLoss(lossRate uint32)
- func (v *SendingWorker) ProcessAck(number uint32) bool
- func (v *SendingWorker) ProcessReceivingNext(nextNumber uint32)
- func (v *SendingWorker) ProcessReceivingNextWithoutLock(nextNumber uint32)
- func (v *SendingWorker) ProcessSegment(current uint32, seg *AckSegment, rto uint32)
- func (v *SendingWorker) Push(b []byte) int
- func (v *SendingWorker) Release()
- func (v *SendingWorker) UpdateNecessary() bool
- func (v *SendingWorker) Write(seg Segment)
- type ServerConnection
- func (o *ServerConnection) Close() error
- func (o *ServerConnection) Id() internal.ConnectionId
- func (o *ServerConnection) LocalAddr() net.Addr
- func (o *ServerConnection) Overhead() int
- func (o *ServerConnection) Read([]byte) (int, error)
- func (o *ServerConnection) RemoteAddr() net.Addr
- func (o *ServerConnection) Reset(input func([]Segment))
- func (o *ServerConnection) SetDeadline(time.Time) error
- func (o *ServerConnection) SetReadDeadline(time.Time) error
- func (o *ServerConnection) SetWriteDeadline(time.Time) error
- func (o *ServerConnection) Write(b []byte) (int, error)
- type SimpleAuthenticator
- type State
- type SystemConnection
- type TTI
- type Updater
- type UplinkCapacity
- type WriteBuffer
- type Writer
Constants ¶
const (
DataSegmentOverhead = 18
)
Variables ¶
Functions ¶
func DialKCP ¶
func DialKCP(src v2net.Address, dest v2net.Destination, options internet.DialerOptions) (internet.Connection, error)
func NewSimpleAuthenticator ¶
NewSimpleAuthenticator creates a new SimpleAuthenticator
Types ¶
type AckList ¶ added in v1.18.1
type AckList struct {
// contains filtered or unexported fields
}
func NewAckList ¶ added in v1.18.1
func NewAckList(writer SegmentWriter) *AckList
type AckSegment ¶ added in v1.18.1
type AckSegment struct { Conv uint16 Option SegmentOption ReceivingWindow uint32 ReceivingNext uint32 Timestamp uint32 Count byte NumberList []uint32 }
func NewAckSegment ¶ added in v1.19.1
func NewAckSegment() *AckSegment
func (*AckSegment) ByteSize ¶ added in v1.18.1
func (v *AckSegment) ByteSize() int
func (*AckSegment) Bytes ¶ added in v1.18.1
func (v *AckSegment) Bytes() buf.Supplier
func (*AckSegment) Command ¶
func (v *AckSegment) Command() Command
func (*AckSegment) Conversation ¶
func (v *AckSegment) Conversation() uint16
func (*AckSegment) IsFull ¶ added in v1.19.1
func (v *AckSegment) IsFull() bool
func (*AckSegment) PutNumber ¶ added in v1.19.1
func (v *AckSegment) PutNumber(number uint32)
func (*AckSegment) PutTimestamp ¶ added in v1.23.1
func (v *AckSegment) PutTimestamp(timestamp uint32)
func (*AckSegment) Release ¶ added in v1.18.1
func (v *AckSegment) Release()
type BufferedSegmentWriter ¶ added in v1.18.1
func NewSegmentWriter ¶ added in v1.18.1
func NewSegmentWriter(writer io.Writer, mtu uint32) *BufferedSegmentWriter
func (*BufferedSegmentWriter) Flush ¶ added in v1.18.1
func (v *BufferedSegmentWriter) Flush()
func (*BufferedSegmentWriter) FlushWithoutLock ¶ added in v1.18.1
func (v *BufferedSegmentWriter) FlushWithoutLock()
func (*BufferedSegmentWriter) Write ¶ added in v1.18.1
func (v *BufferedSegmentWriter) Write(seg Segment)
type ClientConnection ¶
func (*ClientConnection) Close ¶
func (o *ClientConnection) Close() error
func (*ClientConnection) Id ¶
func (o *ClientConnection) Id() internal.ConnectionId
func (*ClientConnection) Overhead ¶
func (o *ClientConnection) Overhead() int
func (*ClientConnection) Reset ¶
func (o *ClientConnection) Reset(inputCallback func([]Segment))
func (*ClientConnection) ResetSecurity ¶
func (o *ClientConnection) ResetSecurity(header internet.PacketHeader, security cipher.AEAD)
func (*ClientConnection) Run ¶
func (o *ClientConnection) Run()
type CmdOnlySegment ¶ added in v1.18.1
type CmdOnlySegment struct { Conv uint16 Cmd Command Option SegmentOption SendingNext uint32 ReceivinNext uint32 PeerRTO uint32 }
func NewCmdOnlySegment ¶ added in v1.19.1
func NewCmdOnlySegment() *CmdOnlySegment
func (*CmdOnlySegment) ByteSize ¶ added in v1.18.1
func (v *CmdOnlySegment) ByteSize() int
func (*CmdOnlySegment) Bytes ¶ added in v1.18.1
func (v *CmdOnlySegment) Bytes() buf.Supplier
func (*CmdOnlySegment) Command ¶ added in v1.21.1
func (v *CmdOnlySegment) Command() Command
func (*CmdOnlySegment) Conversation ¶
func (v *CmdOnlySegment) Conversation() uint16
func (*CmdOnlySegment) Release ¶ added in v1.18.1
func (v *CmdOnlySegment) Release()
type Config ¶
type Config struct { Mtu *MTU `protobuf:"bytes,1,opt,name=mtu" json:"mtu,omitempty"` Tti *TTI `protobuf:"bytes,2,opt,name=tti" json:"tti,omitempty"` UplinkCapacity *UplinkCapacity `protobuf:"bytes,3,opt,name=uplink_capacity,json=uplinkCapacity" json:"uplink_capacity,omitempty"` DownlinkCapacity *DownlinkCapacity `protobuf:"bytes,4,opt,name=downlink_capacity,json=downlinkCapacity" json:"downlink_capacity,omitempty"` Congestion bool `protobuf:"varint,5,opt,name=congestion" json:"congestion,omitempty"` WriteBuffer *WriteBuffer `protobuf:"bytes,6,opt,name=write_buffer,json=writeBuffer" json:"write_buffer,omitempty"` ReadBuffer *ReadBuffer `protobuf:"bytes,7,opt,name=read_buffer,json=readBuffer" json:"read_buffer,omitempty"` HeaderConfig *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,8,opt,name=header_config,json=headerConfig" json:"header_config,omitempty"` ConnectionReuse *ConnectionReuse `protobuf:"bytes,9,opt,name=connection_reuse,json=connectionReuse" json:"connection_reuse,omitempty"` }
func (*Config) Descriptor ¶
func (*Config) GetConnectionReuse ¶
func (m *Config) GetConnectionReuse() *ConnectionReuse
func (*Config) GetDownlinkCapacity ¶
func (m *Config) GetDownlinkCapacity() *DownlinkCapacity
func (*Config) GetHeaderConfig ¶
func (m *Config) GetHeaderConfig() *v2ray_core_common_loader.TypedSettings
func (*Config) GetPackerHeader ¶
func (v *Config) GetPackerHeader() (internet.PacketHeader, error)
func (*Config) GetReadBuffer ¶
func (m *Config) GetReadBuffer() *ReadBuffer
func (*Config) GetReceivingBufferSize ¶
func (*Config) GetReceivingInFlightSize ¶
func (*Config) GetSecurity ¶
GetSecurity returns the security settings.
func (*Config) GetSendingBufferSize ¶
func (*Config) GetSendingInFlightSize ¶ added in v1.18.2
func (*Config) GetUplinkCapacity ¶
func (m *Config) GetUplinkCapacity() *UplinkCapacity
func (*Config) GetWriteBuffer ¶
func (m *Config) GetWriteBuffer() *WriteBuffer
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
type Connection ¶
type Connection struct { Config *Config // contains filtered or unexported fields }
Connection is a KCP connection over UDP.
func NewConnection ¶
func NewConnection(conv uint16, sysConn SystemConnection, recycler internal.ConnectionRecyler, config *Config) *Connection
NewConnection create a new KCP connection between local and remote.
func (*Connection) Elapsed ¶
func (v *Connection) Elapsed() uint32
func (*Connection) HandleOption ¶ added in v1.19.1
func (v *Connection) HandleOption(opt SegmentOption)
func (*Connection) Input ¶ added in v1.19.1
func (v *Connection) Input(segments []Segment)
Input when you received a low level packet (eg. UDP packet), call it
func (*Connection) LocalAddr ¶
func (v *Connection) LocalAddr() net.Addr
LocalAddr returns the local network address. The Addr returned is shared by all invocations of LocalAddr, so do not modify it.
func (*Connection) OnDataInput ¶
func (v *Connection) OnDataInput()
func (*Connection) OnDataOutput ¶
func (v *Connection) OnDataOutput()
func (*Connection) OnPeerClosed ¶ added in v1.19.1
func (v *Connection) OnPeerClosed()
func (*Connection) Ping ¶
func (v *Connection) Ping(current uint32, cmd Command)
func (*Connection) Read ¶
func (v *Connection) Read(b []byte) (int, error)
Read implements the Conn Read method.
func (*Connection) RemoteAddr ¶
func (v *Connection) RemoteAddr() net.Addr
RemoteAddr returns the remote network address. The Addr returned is shared by all invocations of RemoteAddr, so do not modify it.
func (*Connection) Reusable ¶
func (v *Connection) Reusable() bool
func (*Connection) SetDeadline ¶
func (v *Connection) SetDeadline(t time.Time) error
SetDeadline sets the deadline associated with the listener. A zero time value disables the deadline.
func (*Connection) SetReadDeadline ¶
func (v *Connection) SetReadDeadline(t time.Time) error
SetReadDeadline implements the Conn SetReadDeadline method.
func (*Connection) SetReusable ¶
func (v *Connection) SetReusable(b bool)
func (*Connection) SetState ¶ added in v1.19.1
func (v *Connection) SetState(state State)
func (*Connection) SetWriteDeadline ¶
func (v *Connection) SetWriteDeadline(t time.Time) error
SetWriteDeadline implements the Conn SetWriteDeadline method.
func (*Connection) State ¶ added in v1.19.1
func (v *Connection) State() State
func (*Connection) Terminate ¶
func (v *Connection) Terminate()
type ConnectionReuse ¶
type ConnectionReuse struct {
Enable bool `protobuf:"varint,1,opt,name=enable" json:"enable,omitempty"`
}
func (*ConnectionReuse) Descriptor ¶
func (*ConnectionReuse) Descriptor() ([]byte, []int)
func (*ConnectionReuse) IsEnabled ¶
func (o *ConnectionReuse) IsEnabled() bool
func (*ConnectionReuse) ProtoMessage ¶
func (*ConnectionReuse) ProtoMessage()
func (*ConnectionReuse) Reset ¶
func (m *ConnectionReuse) Reset()
func (*ConnectionReuse) String ¶
func (m *ConnectionReuse) String() string
type DataSegment ¶ added in v1.18.1
type DataSegment struct { Conv uint16 Option SegmentOption Timestamp uint32 Number uint32 SendingNext uint32 Data *buf.Buffer // contains filtered or unexported fields }
func NewDataSegment ¶ added in v1.19.1
func NewDataSegment() *DataSegment
func (*DataSegment) ByteSize ¶ added in v1.18.1
func (v *DataSegment) ByteSize() int
func (*DataSegment) Bytes ¶ added in v1.18.1
func (v *DataSegment) Bytes() buf.Supplier
func (*DataSegment) Command ¶
func (v *DataSegment) Command() Command
func (*DataSegment) Conversation ¶
func (v *DataSegment) Conversation() uint16
func (*DataSegment) Release ¶ added in v1.18.1
func (v *DataSegment) Release()
func (*DataSegment) SetData ¶
func (v *DataSegment) SetData(b []byte)
type DownlinkCapacity ¶
type DownlinkCapacity struct {
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}
Downlink capacity, in MB.
func (*DownlinkCapacity) Descriptor ¶
func (*DownlinkCapacity) Descriptor() ([]byte, []int)
func (*DownlinkCapacity) GetValue ¶
func (v *DownlinkCapacity) GetValue() uint32
GetValue returns the value of DownlinkCapacity settings.
func (*DownlinkCapacity) ProtoMessage ¶
func (*DownlinkCapacity) ProtoMessage()
func (*DownlinkCapacity) Reset ¶
func (m *DownlinkCapacity) Reset()
func (*DownlinkCapacity) String ¶
func (m *DownlinkCapacity) String() string
type KCPPacketReader ¶
type KCPPacketReader struct { Security cipher.AEAD Header internet.PacketHeader }
func (*KCPPacketReader) Read ¶
func (v *KCPPacketReader) Read(b []byte) []Segment
type KCPPacketWriter ¶
type KCPPacketWriter struct { Header internet.PacketHeader Security cipher.AEAD Writer io.Writer // contains filtered or unexported fields }
func (*KCPPacketWriter) Overhead ¶
func (v *KCPPacketWriter) Overhead() int
type Listener ¶
Listener defines a server listening for connections
func NewListener ¶
func (*Listener) Accept ¶
func (v *Listener) Accept() (internet.Connection, error)
Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn.
func (*Listener) ActiveConnections ¶ added in v1.19.2
func (*Listener) Addr ¶
Addr returns the listener's network address, The Addr returned is shared by all invocations of Addr, so do not modify it.
func (*Listener) Close ¶
Close stops listening on the UDP address. Already Accepted connections are not closed.
func (*Listener) OnReceive ¶
func (v *Listener) OnReceive(payload *buf.Buffer, session *proxy.SessionInfo)
func (*Listener) Remove ¶
func (v *Listener) Remove(id ConnectionId)
type MTU ¶
type MTU struct {
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}
Maximum Transmission Unit, in bytes.
func (*MTU) Descriptor ¶
func (*MTU) ProtoMessage ¶
func (*MTU) ProtoMessage()
type PacketReader ¶
type PacketWriter ¶
type ReadBuffer ¶
type ReadBuffer struct { // Buffer size in bytes. Size uint32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"` }
func (*ReadBuffer) Descriptor ¶
func (*ReadBuffer) Descriptor() ([]byte, []int)
func (*ReadBuffer) GetSize ¶
func (v *ReadBuffer) GetSize() uint32
GetSize returns the size of ReadBuffer in bytes.
func (*ReadBuffer) ProtoMessage ¶
func (*ReadBuffer) ProtoMessage()
func (*ReadBuffer) Reset ¶
func (m *ReadBuffer) Reset()
func (*ReadBuffer) String ¶
func (m *ReadBuffer) String() string
type ReceivingWindow ¶ added in v1.17.3
type ReceivingWindow struct {
// contains filtered or unexported fields
}
func NewReceivingWindow ¶ added in v1.17.3
func NewReceivingWindow(size uint32) *ReceivingWindow
func (*ReceivingWindow) Advance ¶ added in v1.17.3
func (v *ReceivingWindow) Advance()
func (*ReceivingWindow) Position ¶ added in v1.17.3
func (v *ReceivingWindow) Position(idx uint32) uint32
func (*ReceivingWindow) Remove ¶ added in v1.17.3
func (v *ReceivingWindow) Remove(idx uint32) *DataSegment
func (*ReceivingWindow) RemoveFirst ¶ added in v1.17.3
func (v *ReceivingWindow) RemoveFirst() *DataSegment
func (*ReceivingWindow) Set ¶ added in v1.17.3
func (v *ReceivingWindow) Set(idx uint32, value *DataSegment) bool
func (*ReceivingWindow) Size ¶ added in v1.17.3
func (v *ReceivingWindow) Size() uint32
type ReceivingWorker ¶ added in v1.18.1
func NewReceivingWorker ¶ added in v1.18.1
func NewReceivingWorker(kcp *Connection) *ReceivingWorker
func (*ReceivingWorker) CloseRead ¶ added in v1.18.1
func (v *ReceivingWorker) CloseRead()
func (*ReceivingWorker) Flush ¶ added in v1.18.1
func (v *ReceivingWorker) Flush(current uint32)
func (*ReceivingWorker) ProcessSegment ¶ added in v1.18.1
func (v *ReceivingWorker) ProcessSegment(seg *DataSegment)
func (*ReceivingWorker) ProcessSendingNext ¶ added in v1.18.1
func (v *ReceivingWorker) ProcessSendingNext(number uint32)
func (*ReceivingWorker) Read ¶ added in v1.18.1
func (v *ReceivingWorker) Read(b []byte) int
func (*ReceivingWorker) Release ¶
func (v *ReceivingWorker) Release()
func (*ReceivingWorker) UpdateNecessary ¶
func (v *ReceivingWorker) UpdateNecessary() bool
func (*ReceivingWorker) Write ¶ added in v1.18.1
func (v *ReceivingWorker) Write(seg Segment)
type RoundTripInfo ¶ added in v1.23.1
func (*RoundTripInfo) SmoothedTime ¶ added in v1.23.1
func (v *RoundTripInfo) SmoothedTime() uint32
func (*RoundTripInfo) Timeout ¶ added in v1.23.1
func (v *RoundTripInfo) Timeout() uint32
func (*RoundTripInfo) Update ¶ added in v1.23.1
func (v *RoundTripInfo) Update(rtt uint32, current uint32)
func (*RoundTripInfo) UpdatePeerRTO ¶ added in v1.23.1
func (v *RoundTripInfo) UpdatePeerRTO(rto uint32, current uint32)
type Segment ¶
type Segment interface { common.Releasable Conversation() uint16 Command() Command ByteSize() int Bytes() buf.Supplier }
func ReadSegment ¶ added in v1.18.1
type SegmentOption ¶ added in v1.18.1
type SegmentOption byte
const (
SegmentOptionClose SegmentOption = 1
)
type SegmentWriter ¶ added in v1.18.1
type SegmentWriter interface {
Write(seg Segment)
}
type SendingWindow ¶ added in v1.18.1
type SendingWindow struct {
// contains filtered or unexported fields
}
func NewSendingWindow ¶ added in v1.18.1
func NewSendingWindow(size uint32, writer SegmentWriter, onPacketLoss func(uint32)) *SendingWindow
func (*SendingWindow) Clear ¶ added in v1.18.1
func (v *SendingWindow) Clear(una uint32)
func (*SendingWindow) FirstNumber ¶
func (v *SendingWindow) FirstNumber() uint32
func (*SendingWindow) Flush ¶ added in v1.18.1
func (v *SendingWindow) Flush(current uint32, rto uint32, maxInFlightSize uint32)
func (*SendingWindow) HandleFastAck ¶ added in v1.18.1
func (v *SendingWindow) HandleFastAck(number uint32, rto uint32)
func (*SendingWindow) IsEmpty ¶ added in v1.19.2
func (v *SendingWindow) IsEmpty() bool
func (*SendingWindow) IsFull ¶ added in v1.18.2
func (v *SendingWindow) IsFull() bool
func (*SendingWindow) Len ¶ added in v1.18.1
func (v *SendingWindow) Len() int
func (*SendingWindow) Push ¶ added in v1.18.1
func (v *SendingWindow) Push(number uint32, data []byte)
func (*SendingWindow) Release ¶
func (v *SendingWindow) Release()
func (*SendingWindow) Remove ¶ added in v1.18.1
func (v *SendingWindow) Remove(idx uint32) bool
func (*SendingWindow) Size ¶ added in v1.18.2
func (v *SendingWindow) Size() uint32
func (*SendingWindow) Visit ¶
func (v *SendingWindow) Visit(visitor func(seg *DataSegment) bool)
type SendingWorker ¶ added in v1.18.1
func NewSendingWorker ¶ added in v1.18.1
func NewSendingWorker(kcp *Connection) *SendingWorker
func (*SendingWorker) CloseWrite ¶ added in v1.18.1
func (v *SendingWorker) CloseWrite()
func (*SendingWorker) FindFirstUnacknowledged ¶ added in v1.18.1
func (v *SendingWorker) FindFirstUnacknowledged()
Private: Visible for testing.
func (*SendingWorker) Flush ¶ added in v1.18.1
func (v *SendingWorker) Flush(current uint32)
func (*SendingWorker) IsEmpty ¶ added in v1.19.2
func (v *SendingWorker) IsEmpty() bool
func (*SendingWorker) OnPacketLoss ¶ added in v1.18.1
func (v *SendingWorker) OnPacketLoss(lossRate uint32)
func (*SendingWorker) ProcessAck ¶ added in v1.18.1
func (v *SendingWorker) ProcessAck(number uint32) bool
Private: Visible for testing.
func (*SendingWorker) ProcessReceivingNext ¶ added in v1.18.1
func (v *SendingWorker) ProcessReceivingNext(nextNumber uint32)
func (*SendingWorker) ProcessReceivingNextWithoutLock ¶ added in v1.19.1
func (v *SendingWorker) ProcessReceivingNextWithoutLock(nextNumber uint32)
func (*SendingWorker) ProcessSegment ¶ added in v1.18.2
func (v *SendingWorker) ProcessSegment(current uint32, seg *AckSegment, rto uint32)
func (*SendingWorker) Push ¶ added in v1.18.1
func (v *SendingWorker) Push(b []byte) int
func (*SendingWorker) Release ¶
func (v *SendingWorker) Release()
func (*SendingWorker) UpdateNecessary ¶
func (v *SendingWorker) UpdateNecessary() bool
func (*SendingWorker) Write ¶ added in v1.18.1
func (v *SendingWorker) Write(seg Segment)
Private: Visible for testing.
type ServerConnection ¶
type ServerConnection struct {
// contains filtered or unexported fields
}
func (*ServerConnection) Close ¶
func (o *ServerConnection) Close() error
func (*ServerConnection) Id ¶
func (o *ServerConnection) Id() internal.ConnectionId
func (*ServerConnection) LocalAddr ¶
func (o *ServerConnection) LocalAddr() net.Addr
func (*ServerConnection) Overhead ¶
func (o *ServerConnection) Overhead() int
func (*ServerConnection) RemoteAddr ¶
func (o *ServerConnection) RemoteAddr() net.Addr
func (*ServerConnection) Reset ¶
func (o *ServerConnection) Reset(input func([]Segment))
func (*ServerConnection) SetDeadline ¶
func (o *ServerConnection) SetDeadline(time.Time) error
func (*ServerConnection) SetReadDeadline ¶
func (o *ServerConnection) SetReadDeadline(time.Time) error
func (*ServerConnection) SetWriteDeadline ¶
func (o *ServerConnection) SetWriteDeadline(time.Time) error
type SimpleAuthenticator ¶
type SimpleAuthenticator struct{}
SimpleAuthenticator is a legacy AEAD used for KCP encryption.
func (*SimpleAuthenticator) NonceSize ¶
func (v *SimpleAuthenticator) NonceSize() int
NonceSize implements cipher.AEAD.NonceSize().
func (*SimpleAuthenticator) Open ¶
func (v *SimpleAuthenticator) Open(dst, nonce, cipherText, extra []byte) ([]byte, error)
Open implements cipher.AEAD.Open().
func (*SimpleAuthenticator) Overhead ¶ added in v1.23.1
func (v *SimpleAuthenticator) Overhead() int
Overhead implements cipher.AEAD.NonceSize().
func (*SimpleAuthenticator) Seal ¶
func (v *SimpleAuthenticator) Seal(dst, nonce, plain, extra []byte) []byte
Seal implements cipher.AEAD.Seal().
type SystemConnection ¶
type TTI ¶
type TTI struct {
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}
Transmission Time Interview, in milli-sec.
func (*TTI) Descriptor ¶
func (*TTI) ProtoMessage ¶
func (*TTI) ProtoMessage()
type UplinkCapacity ¶
type UplinkCapacity struct {
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}
Uplink capacity, in MB.
func (*UplinkCapacity) Descriptor ¶
func (*UplinkCapacity) Descriptor() ([]byte, []int)
func (*UplinkCapacity) GetValue ¶
func (v *UplinkCapacity) GetValue() uint32
GetValue returns the value of UplinkCapacity settings.
func (*UplinkCapacity) ProtoMessage ¶
func (*UplinkCapacity) ProtoMessage()
func (*UplinkCapacity) Reset ¶
func (m *UplinkCapacity) Reset()
func (*UplinkCapacity) String ¶
func (m *UplinkCapacity) String() string
type WriteBuffer ¶
type WriteBuffer struct { // Buffer size in bytes. Size uint32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"` }
func (*WriteBuffer) Descriptor ¶
func (*WriteBuffer) Descriptor() ([]byte, []int)
func (*WriteBuffer) GetSize ¶
func (v *WriteBuffer) GetSize() uint32
GetSize returns the size of WriterBuffer in bytes.
func (*WriteBuffer) ProtoMessage ¶
func (*WriteBuffer) ProtoMessage()
func (*WriteBuffer) Reset ¶
func (m *WriteBuffer) Reset()
func (*WriteBuffer) String ¶
func (m *WriteBuffer) String() string