Documentation ¶
Index ¶
- Constants
- func NewClientTracer(logger *zerolog.Logger, index uint8) ...
- func SuffixSessionID(sessionID uuid.UUID, b []byte) ([]byte, error)
- func SuffixType(b []byte, datagramType DatagramV2Type) ([]byte, error)
- type BaseDatagramMuxer
- type DatagramMuxer
- type DatagramMuxerV2
- type DatagramV2Type
- type Packet
- type RawPacket
- type SafeStreamCloser
- type TracedPacket
- type TracingSpanPacket
Constants ¶
const ( HandshakeIdleTimeout = 5 * time.Second MaxIdleTimeout = 5 * time.Second MaxIdlePingPeriod = 1 * time.Second // MaxIncomingStreams is 2^60, which is the maximum supported value by Quic-Go MaxIncomingStreams = 1 << 60 )
const (
MaxDatagramFrameSize = 1350
)
Variables ¶
This section is empty.
Functions ¶
func NewClientTracer ¶
func NewClientTracer(logger *zerolog.Logger, index uint8) func(context.Context, logging.Perspective, logging.ConnectionID) *logging.ConnectionTracer
func SuffixSessionID ¶
SuffixSessionID appends the session ID at the end of the payload. Suffix is more performant than prefix because the payload slice might already have enough capacity to append the session ID at the end
func SuffixType ¶
func SuffixType(b []byte, datagramType DatagramV2Type) ([]byte, error)
Types ¶
type BaseDatagramMuxer ¶
type BaseDatagramMuxer interface { // SendToSession suffix the session ID to the payload so the other end of the QUIC connection can demultiplex the // payload from multiple datagram sessions. SendToSession(session *packet.Session) error // ServeReceive starts a loop to receive datagrams from the QUIC connection ServeReceive(ctx context.Context) error }
type DatagramMuxer ¶
type DatagramMuxer struct {
// contains filtered or unexported fields
}
func NewDatagramMuxer ¶
func NewDatagramMuxer(quicSession quic.Connection, log *zerolog.Logger, demuxChan chan<- *packet.Session) *DatagramMuxer
func (*DatagramMuxer) SendToSession ¶
func (dm *DatagramMuxer) SendToSession(session *packet.Session) error
func (*DatagramMuxer) ServeReceive ¶
func (dm *DatagramMuxer) ServeReceive(ctx context.Context) error
type DatagramMuxerV2 ¶
type DatagramMuxerV2 struct {
// contains filtered or unexported fields
}
func NewDatagramMuxerV2 ¶
func NewDatagramMuxerV2( quicSession quic.Connection, log *zerolog.Logger, sessionDemuxChan chan<- *packet.Session, ) *DatagramMuxerV2
func (*DatagramMuxerV2) ReceivePacket ¶
func (dm *DatagramMuxerV2) ReceivePacket(ctx context.Context) (pk Packet, err error)
func (*DatagramMuxerV2) SendPacket ¶
func (dm *DatagramMuxerV2) SendPacket(pk Packet) error
SendPacket sends a packet with datagram version in the suffix. If ctx is a TracedContext, it adds the tracing context between payload and datagram version. The other end of the QUIC connection can demultiplex by parsing the payload as IP and look at the source and destination.
func (*DatagramMuxerV2) SendToSession ¶
func (dm *DatagramMuxerV2) SendToSession(session *packet.Session) error
SendToSession suffix the session ID and datagram version to the payload so the other end of the QUIC connection can demultiplex the payload from multiple datagram sessions
func (*DatagramMuxerV2) ServeReceive ¶
func (dm *DatagramMuxerV2) ServeReceive(ctx context.Context) error
Demux reads datagrams from the QUIC connection and demuxes depending on whether it's a session or packet
type DatagramV2Type ¶
type DatagramV2Type byte
const ( // UDP payload DatagramTypeUDP DatagramV2Type = iota // Full IP packet DatagramTypeIP // DatagramTypeIP + tracing ID DatagramTypeIPWithTrace // Tracing spans in protobuf format DatagramTypeTracingSpan )
type Packet ¶
type Packet interface { Type() DatagramV2Type Payload() []byte Metadata() []byte }
type SafeStreamCloser ¶
type SafeStreamCloser struct {
// contains filtered or unexported fields
}
func NewSafeStreamCloser ¶
func NewSafeStreamCloser(stream quic.Stream, writeTimeout time.Duration, log *zerolog.Logger) *SafeStreamCloser
func (*SafeStreamCloser) Close ¶
func (s *SafeStreamCloser) Close() error
func (*SafeStreamCloser) CloseWrite ¶
func (s *SafeStreamCloser) CloseWrite() error
func (*SafeStreamCloser) SetDeadline ¶
func (s *SafeStreamCloser) SetDeadline(deadline time.Time) error
type TracedPacket ¶
func (*TracedPacket) Metadata ¶
func (tp *TracedPacket) Metadata() []byte
func (*TracedPacket) Payload ¶
func (tp *TracedPacket) Payload() []byte
func (*TracedPacket) Type ¶
func (tp *TracedPacket) Type() DatagramV2Type
type TracingSpanPacket ¶
func (*TracingSpanPacket) Metadata ¶
func (tsp *TracingSpanPacket) Metadata() []byte
func (*TracingSpanPacket) Payload ¶
func (tsp *TracingSpanPacket) Payload() []byte
func (*TracingSpanPacket) Type ¶
func (tsp *TracingSpanPacket) Type() DatagramV2Type