Source File
protocol.go
Belonging Package
github.com/imroc/req/v3/internal/http3
package http3import ()// Perspective determines if we're acting as a server or a clienttype Perspective int// the perspectivesconst (PerspectiveServer Perspective = 1PerspectiveClient Perspective = 2)// Opposite returns the perspective of the peerfunc ( Perspective) () Perspective {return 3 -}func ( Perspective) () string {switch {case PerspectiveServer:return "server"case PerspectiveClient:return "client"default:return "invalid perspective"}}// The version numbers, making grepping easierconst (VersionUnknown quic.Version = math.MaxUint32versionDraft29 quic.Version = 0xff00001d // draft-29 used to be a widely deployed versionVersion1 quic.Version = 0x1Version2 quic.Version = 0x6b3343cf)// StreamType encodes if this is a unidirectional or bidirectional streamtype StreamType uint8const (// StreamTypeUni is a unidirectional streamStreamTypeUni StreamType = iota// StreamTypeBidi is a bidirectional streamStreamTypeBidi)// InvalidPacketNumber is a stream ID that is invalid.// The first valid stream ID in QUIC is 0.const InvalidStreamID quic.StreamID = -1// StreamNum is the stream numbertype StreamNum int64const (// InvalidStreamNum is an invalid stream number.InvalidStreamNum = -1// MaxStreamCount is the maximum stream count value that can be sent in MAX_STREAMS frames// and as the stream count in the transport parametersMaxStreamCount StreamNum = 1 << 60)// StreamID calculates the stream ID.func ( StreamNum) ( StreamType, Perspective) quic.StreamID {if == 0 {return InvalidStreamID}var quic.StreamIDswitch {case StreamTypeBidi:switch {case PerspectiveClient:= 0case PerspectiveServer:= 1}case StreamTypeUni:switch {case PerspectiveClient:= 2case PerspectiveServer:= 3}}return + 4*quic.StreamID(-1)}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |