Documentation ¶
Index ¶
- Variables
- type CoordPacketType
- func (CoordPacketType) Descriptor() protoreflect.EnumDescriptor
- func (x CoordPacketType) Enum() *CoordPacketType
- func (CoordPacketType) EnumDescriptor() ([]byte, []int)deprecated
- func (x CoordPacketType) Number() protoreflect.EnumNumber
- func (x CoordPacketType) String() string
- func (CoordPacketType) Type() protoreflect.EnumType
- type CoordinationStreamPacket
- func (*CoordinationStreamPacket) Descriptor() ([]byte, []int)deprecated
- func (this *CoordinationStreamPacket) EqualVT(that *CoordinationStreamPacket) bool
- func (x *CoordinationStreamPacket) GetPacketType() CoordPacketType
- func (x *CoordinationStreamPacket) GetRawStreamAck() *RawStreamAck
- func (x *CoordinationStreamPacket) GetRawStreamClose() *RawStreamClose
- func (x *CoordinationStreamPacket) GetRawStreamEstablish() *RawStreamEstablish
- func (m *CoordinationStreamPacket) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *CoordinationStreamPacket) MarshalToVT(dAtA []byte) (int, error)
- func (m *CoordinationStreamPacket) MarshalVT() (dAtA []byte, err error)
- func (*CoordinationStreamPacket) ProtoMessage()
- func (x *CoordinationStreamPacket) ProtoReflect() protoreflect.Message
- func (x *CoordinationStreamPacket) Reset()
- func (m *CoordinationStreamPacket) SizeVT() (n int)
- func (x *CoordinationStreamPacket) String() string
- func (m *CoordinationStreamPacket) UnmarshalVT(dAtA []byte) error
- type HandshakeExtraData
- func (*HandshakeExtraData) Descriptor() ([]byte, []int)deprecated
- func (this *HandshakeExtraData) EqualVT(that *HandshakeExtraData) bool
- func (x *HandshakeExtraData) GetLocalTransportUuid() uint64
- func (m *HandshakeExtraData) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *HandshakeExtraData) MarshalToVT(dAtA []byte) (int, error)
- func (m *HandshakeExtraData) MarshalVT() (dAtA []byte, err error)
- func (*HandshakeExtraData) ProtoMessage()
- func (x *HandshakeExtraData) ProtoReflect() protoreflect.Message
- func (x *HandshakeExtraData) Reset()
- func (m *HandshakeExtraData) SizeVT() (n int)
- func (x *HandshakeExtraData) String() string
- func (m *HandshakeExtraData) UnmarshalVT(dAtA []byte) error
- type KCPMode
- type Link
- func (l *Link) AcceptStream() (stream.Stream, stream.OpenOpts, error)
- func (l *Link) Close() error
- func (l *Link) GetLocalPeer() peer.ID
- func (l *Link) GetRemotePeer() peer.ID
- func (l *Link) GetRemoteTransportUUID() uint64
- func (l *Link) GetTransportUUID() uint64
- func (l *Link) GetUUID() uint64
- func (l *Link) HandlePacket(packetType PacketType, data []byte)
- func (l *Link) OpenStream(opts stream.OpenOpts) (stream.Stream, error)
- type Opts
- func (*Opts) Descriptor() ([]byte, []int)deprecated
- func (this *Opts) EqualVT(that *Opts) bool
- func (x *Opts) GetBlockCompress() blockcompress.BlockCompress
- func (x *Opts) GetBlockCrypt() blockcrypt.BlockCrypt
- func (x *Opts) GetDataShards() uint32
- func (x *Opts) GetKcpMode() KCPMode
- func (x *Opts) GetMtu() uint32
- func (x *Opts) GetParityShards() uint32
- func (x *Opts) GetStreamMuxer() StreamMuxer
- func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Opts) MarshalToVT(dAtA []byte) (int, error)
- func (m *Opts) MarshalVT() (dAtA []byte, err error)
- func (*Opts) ProtoMessage()
- func (x *Opts) ProtoReflect() protoreflect.Message
- func (x *Opts) Reset()
- func (m *Opts) SizeVT() (n int)
- func (x *Opts) String() string
- func (m *Opts) UnmarshalVT(dAtA []byte) error
- type PacketBuffer
- func (s *PacketBuffer) PushPacket(packet []byte)
- func (s *PacketBuffer) Read(b []byte) (n int, err error)
- func (s *PacketBuffer) SetDeadline(t time.Time) error
- func (s *PacketBuffer) SetReadDeadline(t time.Time) error
- func (s *PacketBuffer) SetRemoteStreamID(id uint32)
- func (s *PacketBuffer) SetWriteDeadline(t time.Time) error
- func (s *PacketBuffer) Write(in []byte) (n int, err error)
- type PacketType
- func (PacketType) Descriptor() protoreflect.EnumDescriptor
- func (x PacketType) Enum() *PacketType
- func (PacketType) EnumDescriptor() ([]byte, []int)deprecated
- func (x PacketType) Number() protoreflect.EnumNumber
- func (x PacketType) String() string
- func (PacketType) Type() protoreflect.EnumType
- func (t PacketType) Validate() error
- type RawStreamAck
- func (*RawStreamAck) Descriptor() ([]byte, []int)deprecated
- func (this *RawStreamAck) EqualVT(that *RawStreamAck) bool
- func (x *RawStreamAck) GetAckError() string
- func (x *RawStreamAck) GetAckStreamId() uint32
- func (x *RawStreamAck) GetInitiatorStreamId() uint32
- func (m *RawStreamAck) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RawStreamAck) MarshalToVT(dAtA []byte) (int, error)
- func (m *RawStreamAck) MarshalVT() (dAtA []byte, err error)
- func (*RawStreamAck) ProtoMessage()
- func (x *RawStreamAck) ProtoReflect() protoreflect.Message
- func (x *RawStreamAck) Reset()
- func (m *RawStreamAck) SizeVT() (n int)
- func (x *RawStreamAck) String() string
- func (m *RawStreamAck) UnmarshalVT(dAtA []byte) error
- func (p *RawStreamAck) Validate() error
- type RawStreamClose
- func (*RawStreamClose) Descriptor() ([]byte, []int)deprecated
- func (this *RawStreamClose) EqualVT(that *RawStreamClose) bool
- func (x *RawStreamClose) GetCloseError() string
- func (x *RawStreamClose) GetStreamId() uint32
- func (m *RawStreamClose) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RawStreamClose) MarshalToVT(dAtA []byte) (int, error)
- func (m *RawStreamClose) MarshalVT() (dAtA []byte, err error)
- func (*RawStreamClose) ProtoMessage()
- func (x *RawStreamClose) ProtoReflect() protoreflect.Message
- func (x *RawStreamClose) Reset()
- func (m *RawStreamClose) SizeVT() (n int)
- func (x *RawStreamClose) String() string
- func (m *RawStreamClose) UnmarshalVT(dAtA []byte) error
- type RawStreamEstablish
- func (*RawStreamEstablish) Descriptor() ([]byte, []int)deprecated
- func (this *RawStreamEstablish) EqualVT(that *RawStreamEstablish) bool
- func (x *RawStreamEstablish) GetInitiatorStreamId() uint32
- func (m *RawStreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RawStreamEstablish) MarshalToVT(dAtA []byte) (int, error)
- func (m *RawStreamEstablish) MarshalVT() (dAtA []byte, err error)
- func (*RawStreamEstablish) ProtoMessage()
- func (x *RawStreamEstablish) ProtoReflect() protoreflect.Message
- func (x *RawStreamEstablish) Reset()
- func (m *RawStreamEstablish) SizeVT() (n int)
- func (x *RawStreamEstablish) String() string
- func (m *RawStreamEstablish) UnmarshalVT(dAtA []byte) error
- type StreamMuxer
- func (StreamMuxer) Descriptor() protoreflect.EnumDescriptor
- func (x StreamMuxer) Enum() *StreamMuxer
- func (StreamMuxer) EnumDescriptor() ([]byte, []int)deprecated
- func (x StreamMuxer) Number() protoreflect.EnumNumber
- func (x StreamMuxer) String() string
- func (StreamMuxer) Type() protoreflect.EnumType
- type Transport
- func (u *Transport) Close() error
- func (u *Transport) DialPeer(ctx context.Context, peerID peer.ID, as string) (bool, error)
- func (u *Transport) Execute(ctx context.Context) error
- func (u *Transport) GetPeerID() peer.ID
- func (u *Transport) GetUUID() uint64
- func (c *Transport) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
- func (u *Transport) LocalAddr() net.Addr
Constants ¶
This section is empty.
Variables ¶
var ( CoordPacketType_name = map[int32]string{ 0: "CoordPacketType_UNKNOWN", 1: "CoordPacketType_RSTREAM_ESTABLISH", 2: "CoordPacketType_RSTREAM_ACK", 3: "CoordPacketType_RSTREAM_CLOSE", 4: "CoordPacketType_RSTREAM_NOOP", } CoordPacketType_value = map[string]int32{ "CoordPacketType_UNKNOWN": 0, "CoordPacketType_RSTREAM_ESTABLISH": 1, "CoordPacketType_RSTREAM_ACK": 2, "CoordPacketType_RSTREAM_CLOSE": 3, "CoordPacketType_RSTREAM_NOOP": 4, } )
Enum value maps for CoordPacketType.
var ( ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") )
var ( KCPMode_name = map[int32]string{ 0: "KCPMode_UNKNOWN", 1: "KCPMode_NORMAL", 2: "KCPMode_FAST", 3: "KCPMode_FAST2", 4: "KCPMode_FAST3", 5: "KCPMode_SLOW1", } KCPMode_value = map[string]int32{ "KCPMode_UNKNOWN": 0, "KCPMode_NORMAL": 1, "KCPMode_FAST": 2, "KCPMode_FAST2": 3, "KCPMode_FAST3": 4, "KCPMode_SLOW1": 5, } )
Enum value maps for KCPMode.
var ( StreamMuxer_name = map[int32]string{ 0: "StreamMuxer_UNKNOWN", 1: "StreamMuxer_XTACI_SMUX", 2: "StreamMuxer_YAMUX", } StreamMuxer_value = map[string]int32{ "StreamMuxer_UNKNOWN": 0, "StreamMuxer_XTACI_SMUX": 1, "StreamMuxer_YAMUX": 2, } )
Enum value maps for StreamMuxer.
var ( PacketType_name = map[int32]string{ 0: "PacketType_HANDSHAKE", 1: "PacketType_RAW", 2: "PacketType_KCP_SMUX", 3: "PacketType_CLOSE_LINK", } PacketType_value = map[string]int32{ "PacketType_HANDSHAKE": 0, "PacketType_RAW": 1, "PacketType_KCP_SMUX": 2, "PacketType_CLOSE_LINK": 3, } )
Enum value maps for PacketType.
var File_github_com_aperturerobotics_bifrost_transport_common_kcp_coord_stream_proto protoreflect.FileDescriptor
var File_github_com_aperturerobotics_bifrost_transport_common_kcp_kcp_handshake_proto protoreflect.FileDescriptor
var File_github_com_aperturerobotics_bifrost_transport_common_kcp_kcp_proto protoreflect.FileDescriptor
var File_github_com_aperturerobotics_bifrost_transport_common_kcp_packet_type_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type CoordPacketType ¶
type CoordPacketType int32
CoordPacketType is the packet type of a coordination stream packet.
const ( CoordPacketType_CoordPacketType_UNKNOWN CoordPacketType = 0 CoordPacketType_CoordPacketType_RSTREAM_ESTABLISH CoordPacketType = 1 CoordPacketType_CoordPacketType_RSTREAM_ACK CoordPacketType = 2 CoordPacketType_CoordPacketType_RSTREAM_CLOSE CoordPacketType = 3 CoordPacketType_CoordPacketType_RSTREAM_NOOP CoordPacketType = 4 )
func (CoordPacketType) Descriptor ¶ added in v0.2.0
func (CoordPacketType) Descriptor() protoreflect.EnumDescriptor
func (CoordPacketType) Enum ¶ added in v0.2.0
func (x CoordPacketType) Enum() *CoordPacketType
func (CoordPacketType) EnumDescriptor
deprecated
func (CoordPacketType) EnumDescriptor() ([]byte, []int)
Deprecated: Use CoordPacketType.Descriptor instead.
func (CoordPacketType) Number ¶ added in v0.2.0
func (x CoordPacketType) Number() protoreflect.EnumNumber
func (CoordPacketType) String ¶
func (x CoordPacketType) String() string
func (CoordPacketType) Type ¶ added in v0.2.0
func (CoordPacketType) Type() protoreflect.EnumType
type CoordinationStreamPacket ¶
type CoordinationStreamPacket struct { // PacketType is the coordination stream packet type. PacketType CoordPacketType `protobuf:"varint,1,opt,name=packet_type,json=packetType,proto3,enum=kcp.CoordPacketType" json:"packet_type,omitempty"` // RawStreamEstablish is the raw stream establish packet. RawStreamEstablish *RawStreamEstablish `protobuf:"bytes,2,opt,name=raw_stream_establish,json=rawStreamEstablish,proto3" json:"raw_stream_establish,omitempty"` // RawStreamAck is the raw stream ack packet. RawStreamAck *RawStreamAck `protobuf:"bytes,3,opt,name=raw_stream_ack,json=rawStreamAck,proto3" json:"raw_stream_ack,omitempty"` // RawStreamClose is the raw stream close packet. RawStreamClose *RawStreamClose `protobuf:"bytes,4,opt,name=raw_stream_close,json=rawStreamClose,proto3" json:"raw_stream_close,omitempty"` // contains filtered or unexported fields }
CoordinationStreamPacket is the packet wrapper for a coordination stream packet.
func (*CoordinationStreamPacket) Descriptor
deprecated
func (*CoordinationStreamPacket) Descriptor() ([]byte, []int)
Deprecated: Use CoordinationStreamPacket.ProtoReflect.Descriptor instead.
func (*CoordinationStreamPacket) EqualVT ¶ added in v0.3.0
func (this *CoordinationStreamPacket) EqualVT(that *CoordinationStreamPacket) bool
func (*CoordinationStreamPacket) GetPacketType ¶
func (x *CoordinationStreamPacket) GetPacketType() CoordPacketType
func (*CoordinationStreamPacket) GetRawStreamAck ¶
func (x *CoordinationStreamPacket) GetRawStreamAck() *RawStreamAck
func (*CoordinationStreamPacket) GetRawStreamClose ¶
func (x *CoordinationStreamPacket) GetRawStreamClose() *RawStreamClose
func (*CoordinationStreamPacket) GetRawStreamEstablish ¶
func (x *CoordinationStreamPacket) GetRawStreamEstablish() *RawStreamEstablish
func (*CoordinationStreamPacket) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *CoordinationStreamPacket) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*CoordinationStreamPacket) MarshalToVT ¶ added in v0.2.0
func (m *CoordinationStreamPacket) MarshalToVT(dAtA []byte) (int, error)
func (*CoordinationStreamPacket) MarshalVT ¶ added in v0.2.0
func (m *CoordinationStreamPacket) MarshalVT() (dAtA []byte, err error)
func (*CoordinationStreamPacket) ProtoMessage ¶
func (*CoordinationStreamPacket) ProtoMessage()
func (*CoordinationStreamPacket) ProtoReflect ¶ added in v0.2.0
func (x *CoordinationStreamPacket) ProtoReflect() protoreflect.Message
func (*CoordinationStreamPacket) Reset ¶
func (x *CoordinationStreamPacket) Reset()
func (*CoordinationStreamPacket) SizeVT ¶ added in v0.2.0
func (m *CoordinationStreamPacket) SizeVT() (n int)
func (*CoordinationStreamPacket) String ¶
func (x *CoordinationStreamPacket) String() string
func (*CoordinationStreamPacket) UnmarshalVT ¶ added in v0.2.0
func (m *CoordinationStreamPacket) UnmarshalVT(dAtA []byte) error
type HandshakeExtraData ¶
type HandshakeExtraData struct { // LocalTransportUuid is the transport uuid of the sender. // This is used for monitoring / analysis at a later time. // Coorelates the transport connections between two machines. LocalTransportUuid uint64 `protobuf:"varint,1,opt,name=local_transport_uuid,json=localTransportUuid,proto3" json:"local_transport_uuid,omitempty"` // contains filtered or unexported fields }
HandshakeExtraData contains the extra data field of the pconn handshake.
func (*HandshakeExtraData) Descriptor
deprecated
func (*HandshakeExtraData) Descriptor() ([]byte, []int)
Deprecated: Use HandshakeExtraData.ProtoReflect.Descriptor instead.
func (*HandshakeExtraData) EqualVT ¶ added in v0.3.0
func (this *HandshakeExtraData) EqualVT(that *HandshakeExtraData) bool
func (*HandshakeExtraData) GetLocalTransportUuid ¶
func (x *HandshakeExtraData) GetLocalTransportUuid() uint64
func (*HandshakeExtraData) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *HandshakeExtraData) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*HandshakeExtraData) MarshalToVT ¶ added in v0.2.0
func (m *HandshakeExtraData) MarshalToVT(dAtA []byte) (int, error)
func (*HandshakeExtraData) MarshalVT ¶ added in v0.2.0
func (m *HandshakeExtraData) MarshalVT() (dAtA []byte, err error)
func (*HandshakeExtraData) ProtoMessage ¶
func (*HandshakeExtraData) ProtoMessage()
func (*HandshakeExtraData) ProtoReflect ¶ added in v0.2.0
func (x *HandshakeExtraData) ProtoReflect() protoreflect.Message
func (*HandshakeExtraData) Reset ¶
func (x *HandshakeExtraData) Reset()
func (*HandshakeExtraData) SizeVT ¶ added in v0.2.0
func (m *HandshakeExtraData) SizeVT() (n int)
func (*HandshakeExtraData) String ¶
func (x *HandshakeExtraData) String() string
func (*HandshakeExtraData) UnmarshalVT ¶ added in v0.2.0
func (m *HandshakeExtraData) UnmarshalVT(dAtA []byte) error
type KCPMode ¶
type KCPMode int32
KCPMode is the mode to set KCP to.
const ( // KCPMode_UNKNOWN defaults to normal mode. KCPMode_KCPMode_UNKNOWN KCPMode = 0 // KCPMode_NORMAL is the normal mode. // NoDelay = 0 // Interval = 40 // Resend = 2 // NoCongestion = 1 KCPMode_KCPMode_NORMAL KCPMode = 1 // KCPMode_FAST is the "fast" mode. // NoDelay = 0 // Interval = 30 // Resend = 2 // NoCongestion = 1 KCPMode_KCPMode_FAST KCPMode = 2 // KCPMode_FAST2 is the "fast2" mode. // NoDelay = 1 // Interval = 20 // Resend = 2 // NoCongestion = 1 KCPMode_KCPMode_FAST2 KCPMode = 3 // KCPMode_FAST3 is the "fast3" mode. // NoDelay = 1 // Interval = 10 // Resend = 2 // NoCongestion = 1 KCPMode_KCPMode_FAST3 KCPMode = 4 // KCPMode_SLOW1 is the slow 1 mode. // NoDelay = 0 // Interval = 100 // Resend = 0 // NoCongestion = 0 KCPMode_KCPMode_SLOW1 KCPMode = 5 )
func (KCPMode) Descriptor ¶ added in v0.2.0
func (KCPMode) Descriptor() protoreflect.EnumDescriptor
func (KCPMode) EnumDescriptor
deprecated
func (KCPMode) Number ¶ added in v0.2.0
func (x KCPMode) Number() protoreflect.EnumNumber
func (KCPMode) Type ¶ added in v0.2.0
func (KCPMode) Type() protoreflect.EnumType
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link represents a KCP-based connection/link.
func NewLink ¶
func NewLink( ctx context.Context, le *logrus.Entry, opts *Opts, localPeerID peer.ID, localAddr, remoteAddr net.Addr, transportUUID, remoteTransportUUID uint64, neg *identity.Result, writer func(b []byte, addr net.Addr) (n int, err error), initiator bool, closed func(), ) (*Link, error)
NewLink builds a new link.
func (*Link) AcceptStream ¶
AcceptStream accepts a stream from the link.
func (*Link) GetLocalPeer ¶
GetLocalPeer returns the identity of the local peer.
func (*Link) GetRemotePeer ¶
GetRemotePeer returns the identity of the remote peer if encrypted.
func (*Link) GetRemoteTransportUUID ¶
GetRemoteTransportUUID returns the unique ID of the remote transport. Reported by the remote peer. May be zero or unreliable value.
func (*Link) GetTransportUUID ¶
GetTransportUUID returns the unique ID of the transport.
func (*Link) HandlePacket ¶
func (l *Link) HandlePacket(packetType PacketType, data []byte)
HandlePacket handles a packet.
type Opts ¶
type Opts struct { // DataShards are the number of FEC data shards to use. By adding t check // symbols to the data, a Reed–Solomon code can detect any combination of up // to t erroneous symbols, or correct up to ⌊t/2⌋ symbols. As an erasure code, // it can correct up to t known erasures, or it can detect and correct // combinations of errors and erasures. Furthermore, Reed–Solomon codes are // suitable as multiple-burst bit-error correcting codes, since a sequence of // b + 1 consecutive bit errors can affect at most two symbols of size b. The // choice of t is up to the designer of the code, and may be selected within // wide limits. Maximum is 256. // Recommended: 10 // If zero, FEC is disabled. DataShards uint32 `protobuf:"varint,1,opt,name=data_shards,json=dataShards,proto3" json:"data_shards,omitempty"` // ParityShards are the number of FEC parity shards to use. // Recommended: 3 ParityShards uint32 `protobuf:"varint,2,opt,name=parity_shards,json=parityShards,proto3" json:"parity_shards,omitempty"` // Mtu is the maximum transmission unit to use. // Defaults to 1350 (UDP safe packet size). Mtu uint32 `protobuf:"varint,3,opt,name=mtu,proto3" json:"mtu,omitempty"` // KcpMode is the KCP mode. KcpMode KCPMode `protobuf:"varint,4,opt,name=kcp_mode,json=kcpMode,proto3,enum=kcp.KCPMode" json:"kcp_mode,omitempty"` // BlockCrypt is the block crypto to use. // Defaults to AES256. // Uses the handshake-negotiated session key. BlockCrypt blockcrypt.BlockCrypt `protobuf:"varint,5,opt,name=block_crypt,json=blockCrypt,proto3,enum=blockcrypt.BlockCrypt" json:"block_crypt,omitempty"` // BlockCompress is the block compression to use. BlockCompress blockcompress.BlockCompress `` /* 134-byte string literal not displayed */ // StreamMuxer is the stream muxer to use. // Defaults to smux. StreamMuxer StreamMuxer `protobuf:"varint,7,opt,name=stream_muxer,json=streamMuxer,proto3,enum=kcp.StreamMuxer" json:"stream_muxer,omitempty"` // contains filtered or unexported fields }
Opts are extra options for the packet conn.
func (*Opts) Descriptor
deprecated
func (*Opts) GetBlockCompress ¶
func (x *Opts) GetBlockCompress() blockcompress.BlockCompress
func (*Opts) GetBlockCrypt ¶
func (x *Opts) GetBlockCrypt() blockcrypt.BlockCrypt
func (*Opts) GetDataShards ¶
func (*Opts) GetKcpMode ¶
func (*Opts) GetParityShards ¶
func (*Opts) GetStreamMuxer ¶
func (x *Opts) GetStreamMuxer() StreamMuxer
func (*Opts) MarshalToSizedBufferVT ¶ added in v0.2.0
func (*Opts) ProtoMessage ¶
func (*Opts) ProtoMessage()
func (*Opts) ProtoReflect ¶ added in v0.2.0
func (x *Opts) ProtoReflect() protoreflect.Message
func (*Opts) UnmarshalVT ¶ added in v0.2.0
type PacketBuffer ¶
type PacketBuffer struct {
// contains filtered or unexported fields
}
PacketBuffer implements a net.Conn backed by a packet buffer
func NewPacketBuffer ¶
func NewPacketBuffer( ctx context.Context, writeFn func(data []byte) error, ) *PacketBuffer
func (*PacketBuffer) PushPacket ¶
func (s *PacketBuffer) PushPacket(packet []byte)
PushPacket pushes a packet to the stream, dropping the oldest packet if necessary.
func (*PacketBuffer) Read ¶
func (s *PacketBuffer) Read(b []byte) (n int, err error)
Read data from the stream.
func (*PacketBuffer) SetDeadline ¶
func (s *PacketBuffer) SetDeadline(t time.Time) error
SetDeadline sets both read and write deadlines as defined by A zero time value disables the deadlines.
func (*PacketBuffer) SetReadDeadline ¶
func (s *PacketBuffer) SetReadDeadline(t time.Time) error
SetReadDeadline sets the read deadline as defined by A zero time value disables the deadline.
func (*PacketBuffer) SetRemoteStreamID ¶
func (s *PacketBuffer) SetRemoteStreamID(id uint32)
SetRemoteStreamID sets the remote stream ID varint trailer
func (*PacketBuffer) SetWriteDeadline ¶
func (s *PacketBuffer) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the write deadline as defined by A zero time value disables the deadline.
type PacketType ¶
type PacketType int32
PacketType is a one-byte trailer indicating the type of packet.
const ( PacketType_PacketType_HANDSHAKE PacketType = 0 PacketType_PacketType_RAW PacketType = 1 PacketType_PacketType_KCP_SMUX PacketType = 2 PacketType_PacketType_CLOSE_LINK PacketType = 3 )
func (PacketType) Descriptor ¶ added in v0.2.0
func (PacketType) Descriptor() protoreflect.EnumDescriptor
func (PacketType) Enum ¶ added in v0.2.0
func (x PacketType) Enum() *PacketType
func (PacketType) EnumDescriptor
deprecated
func (PacketType) EnumDescriptor() ([]byte, []int)
Deprecated: Use PacketType.Descriptor instead.
func (PacketType) Number ¶ added in v0.2.0
func (x PacketType) Number() protoreflect.EnumNumber
func (PacketType) String ¶
func (x PacketType) String() string
func (PacketType) Type ¶ added in v0.2.0
func (PacketType) Type() protoreflect.EnumType
func (PacketType) Validate ¶
func (t PacketType) Validate() error
Validate returns an error if the type is not valid.
type RawStreamAck ¶
type RawStreamAck struct { // InitiatorStreamId is the stream ID the initiator wanted to use. InitiatorStreamId uint32 `protobuf:"varint,1,opt,name=initiator_stream_id,json=initiatorStreamId,proto3" json:"initiator_stream_id,omitempty"` // AckStreamId is the stream ID the responder wants to use. // Zero if the stream was rejected. AckStreamId uint32 `protobuf:"varint,2,opt,name=ack_stream_id,json=ackStreamId,proto3" json:"ack_stream_id,omitempty"` // AckError indicates an error establishing the stream, rejecting the stream. AckError string `protobuf:"bytes,3,opt,name=ack_error,json=ackError,proto3" json:"ack_error,omitempty"` // contains filtered or unexported fields }
RawStreamAck is a coordination stream raw-stream acknowledge message.
func (*RawStreamAck) Descriptor
deprecated
func (*RawStreamAck) Descriptor() ([]byte, []int)
Deprecated: Use RawStreamAck.ProtoReflect.Descriptor instead.
func (*RawStreamAck) EqualVT ¶ added in v0.3.0
func (this *RawStreamAck) EqualVT(that *RawStreamAck) bool
func (*RawStreamAck) GetAckError ¶
func (x *RawStreamAck) GetAckError() string
func (*RawStreamAck) GetAckStreamId ¶
func (x *RawStreamAck) GetAckStreamId() uint32
func (*RawStreamAck) GetInitiatorStreamId ¶
func (x *RawStreamAck) GetInitiatorStreamId() uint32
func (*RawStreamAck) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *RawStreamAck) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RawStreamAck) MarshalToVT ¶ added in v0.2.0
func (m *RawStreamAck) MarshalToVT(dAtA []byte) (int, error)
func (*RawStreamAck) MarshalVT ¶ added in v0.2.0
func (m *RawStreamAck) MarshalVT() (dAtA []byte, err error)
func (*RawStreamAck) ProtoMessage ¶
func (*RawStreamAck) ProtoMessage()
func (*RawStreamAck) ProtoReflect ¶ added in v0.2.0
func (x *RawStreamAck) ProtoReflect() protoreflect.Message
func (*RawStreamAck) Reset ¶
func (x *RawStreamAck) Reset()
func (*RawStreamAck) SizeVT ¶ added in v0.2.0
func (m *RawStreamAck) SizeVT() (n int)
func (*RawStreamAck) String ¶
func (x *RawStreamAck) String() string
func (*RawStreamAck) UnmarshalVT ¶ added in v0.2.0
func (m *RawStreamAck) UnmarshalVT(dAtA []byte) error
func (*RawStreamAck) Validate ¶
func (p *RawStreamAck) Validate() error
Validate validates the raw stream ack packet.
type RawStreamClose ¶
type RawStreamClose struct { // StreamId is the stream ID the reciever indicated to use. StreamId uint32 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` // CloseError indicates an error included with the stream close. CloseError string `protobuf:"bytes,2,opt,name=close_error,json=closeError,proto3" json:"close_error,omitempty"` // contains filtered or unexported fields }
RawStreamClose indicates an intent to close a raw stream.
func (*RawStreamClose) Descriptor
deprecated
func (*RawStreamClose) Descriptor() ([]byte, []int)
Deprecated: Use RawStreamClose.ProtoReflect.Descriptor instead.
func (*RawStreamClose) EqualVT ¶ added in v0.3.0
func (this *RawStreamClose) EqualVT(that *RawStreamClose) bool
func (*RawStreamClose) GetCloseError ¶
func (x *RawStreamClose) GetCloseError() string
func (*RawStreamClose) GetStreamId ¶
func (x *RawStreamClose) GetStreamId() uint32
func (*RawStreamClose) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *RawStreamClose) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RawStreamClose) MarshalToVT ¶ added in v0.2.0
func (m *RawStreamClose) MarshalToVT(dAtA []byte) (int, error)
func (*RawStreamClose) MarshalVT ¶ added in v0.2.0
func (m *RawStreamClose) MarshalVT() (dAtA []byte, err error)
func (*RawStreamClose) ProtoMessage ¶
func (*RawStreamClose) ProtoMessage()
func (*RawStreamClose) ProtoReflect ¶ added in v0.2.0
func (x *RawStreamClose) ProtoReflect() protoreflect.Message
func (*RawStreamClose) Reset ¶
func (x *RawStreamClose) Reset()
func (*RawStreamClose) SizeVT ¶ added in v0.2.0
func (m *RawStreamClose) SizeVT() (n int)
func (*RawStreamClose) String ¶
func (x *RawStreamClose) String() string
func (*RawStreamClose) UnmarshalVT ¶ added in v0.2.0
func (m *RawStreamClose) UnmarshalVT(dAtA []byte) error
type RawStreamEstablish ¶
type RawStreamEstablish struct { // InitiatorStreamId is the stream ID the initiator wants to use. InitiatorStreamId uint32 `protobuf:"varint,1,opt,name=initiator_stream_id,json=initiatorStreamId,proto3" json:"initiator_stream_id,omitempty"` // contains filtered or unexported fields }
RawStreamEstablish is a coordination stream raw-stream establish message.
func (*RawStreamEstablish) Descriptor
deprecated
func (*RawStreamEstablish) Descriptor() ([]byte, []int)
Deprecated: Use RawStreamEstablish.ProtoReflect.Descriptor instead.
func (*RawStreamEstablish) EqualVT ¶ added in v0.3.0
func (this *RawStreamEstablish) EqualVT(that *RawStreamEstablish) bool
func (*RawStreamEstablish) GetInitiatorStreamId ¶
func (x *RawStreamEstablish) GetInitiatorStreamId() uint32
func (*RawStreamEstablish) MarshalToSizedBufferVT ¶ added in v0.2.0
func (m *RawStreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RawStreamEstablish) MarshalToVT ¶ added in v0.2.0
func (m *RawStreamEstablish) MarshalToVT(dAtA []byte) (int, error)
func (*RawStreamEstablish) MarshalVT ¶ added in v0.2.0
func (m *RawStreamEstablish) MarshalVT() (dAtA []byte, err error)
func (*RawStreamEstablish) ProtoMessage ¶
func (*RawStreamEstablish) ProtoMessage()
func (*RawStreamEstablish) ProtoReflect ¶ added in v0.2.0
func (x *RawStreamEstablish) ProtoReflect() protoreflect.Message
func (*RawStreamEstablish) Reset ¶
func (x *RawStreamEstablish) Reset()
func (*RawStreamEstablish) SizeVT ¶ added in v0.2.0
func (m *RawStreamEstablish) SizeVT() (n int)
func (*RawStreamEstablish) String ¶
func (x *RawStreamEstablish) String() string
func (*RawStreamEstablish) UnmarshalVT ¶ added in v0.2.0
func (m *RawStreamEstablish) UnmarshalVT(dAtA []byte) error
type StreamMuxer ¶
type StreamMuxer int32
StreamMuxer sets the type of stream muxer to use.
const ( // StreamMuxer_UNKNOWN defaults to StreamMuxer_XTACI_SMUX StreamMuxer_StreamMuxer_UNKNOWN StreamMuxer = 0 // StreamMuxer_XTACI_SMUX is the xtaci/smux muxer. StreamMuxer_StreamMuxer_XTACI_SMUX StreamMuxer = 1 // StreamMuxer_YAMUX is the yamux muxer. StreamMuxer_StreamMuxer_YAMUX StreamMuxer = 2 )
func (StreamMuxer) Descriptor ¶ added in v0.2.0
func (StreamMuxer) Descriptor() protoreflect.EnumDescriptor
func (StreamMuxer) Enum ¶ added in v0.2.0
func (x StreamMuxer) Enum() *StreamMuxer
func (StreamMuxer) EnumDescriptor
deprecated
func (StreamMuxer) EnumDescriptor() ([]byte, []int)
Deprecated: Use StreamMuxer.Descriptor instead.
func (StreamMuxer) Number ¶ added in v0.2.0
func (x StreamMuxer) Number() protoreflect.EnumNumber
func (StreamMuxer) String ¶
func (x StreamMuxer) String() string
func (StreamMuxer) Type ¶ added in v0.2.0
func (StreamMuxer) Type() protoreflect.EnumType
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a net.PacketConn based transport. The remote address string is used as an identifying key for sessions. It uses KCP to upgrade remote connections to reliable streams.
func New ¶
func New( le *logrus.Entry, uuid uint64, pc net.PacketConn, pKey crypto.PrivKey, addrParser func(addr string) (net.Addr, error), tc transport.TransportHandler, opts *Opts, ) *Transport
New builds a new packet-conn based transport, listening on the addr.
func (*Transport) DialPeer ¶
DialPeer dials a peer given an address. The yielded link should be emitted to the transport handler. DialPeer should return nil if the link was established. DialPeer will then not be called again for the same peer ID and address tuple until the yielded link is lost.
func (*Transport) Execute ¶
Execute processes the transport, emitting events to the handler. Fatal errors are returned.
func (*Transport) HandleDirective ¶
func (c *Transport) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any exceptional errors are returned for logging. It is safe to add a reference to the directive during this call.