mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
impl: QUIC Header mimicry
This commit is contained in:
parent
1429e6718b
commit
251b3afe6e
11 changed files with 262 additions and 30 deletions
|
@ -96,6 +96,8 @@ type sentPacketHandler struct {
|
|||
|
||||
tracer logging.ConnectionTracer
|
||||
logger utils.Logger
|
||||
|
||||
initialPacketNumberLength protocol.PacketNumberLen // [UQUIC]
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -136,6 +138,12 @@ func newSentPacketHandler(
|
|||
}
|
||||
}
|
||||
|
||||
func SetInitialPacketNumberLength(h SentPacketHandler, pnLen protocol.PacketNumberLen) {
|
||||
if sph, ok := h.(*sentPacketHandler); ok {
|
||||
sph.initialPacketNumberLength = pnLen
|
||||
}
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) removeFromBytesInFlight(p *packet) {
|
||||
if p.includedInBytesInFlight {
|
||||
if p.Length > h.bytesInFlight {
|
||||
|
@ -716,6 +724,12 @@ func (h *sentPacketHandler) PeekPacketNumber(encLevel protocol.EncryptionLevel)
|
|||
pnSpace := h.getPacketNumberSpace(encLevel)
|
||||
pn := pnSpace.pns.Peek()
|
||||
// See section 17.1 of RFC 9000.
|
||||
|
||||
// [UQUIC] This kinda breaks PN length mimicry.
|
||||
if encLevel == protocol.EncryptionInitial && h.initialPacketNumberLength != 0 {
|
||||
return pn, h.initialPacketNumberLength
|
||||
}
|
||||
|
||||
return pn, protocol.GetPacketNumberLengthForHeader(pn, pnSpace.largestAcked)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue