mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
new: support variable length quic frame padding (#10)
Add variable length QUIC frame padding support. Refactor how QUIC frames are defined in a QUIC Spec. Update documentation and examples. Added Chrome and Firefox parrots. Close #3.
This commit is contained in:
parent
5e966a9bec
commit
9d3fe2aa07
8 changed files with 1154 additions and 478 deletions
|
@ -1,8 +1,10 @@
|
|||
package quic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/gaukas/clienthellod"
|
||||
"github.com/refraction-networking/uquic/internal/handshake"
|
||||
"github.com/refraction-networking/uquic/internal/protocol"
|
||||
"github.com/refraction-networking/uquic/internal/wire"
|
||||
|
@ -234,10 +236,23 @@ func (p *uPacketPacker) MarshalInitialPacketPayload(pl payload, v protocol.Versi
|
|||
}
|
||||
}
|
||||
|
||||
uPayload, err := p.uSpec.InitialPacketSpec.FrameOrder.MarshalWithFrames(originalFrameBytes)
|
||||
// extract CryptoData from originalFrameBytes
|
||||
// parse frames
|
||||
r := bytes.NewReader(originalFrameBytes)
|
||||
qchframes, err := clienthellod.ReadAllFrames(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return uPayload, nil
|
||||
// parse crypto data
|
||||
cryptoData, err := clienthellod.ReassembleCRYPTOFrames(qchframes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if p.uSpec.InitialPacketSpec.FrameBuilder == nil {
|
||||
qfs := QUICFrames{}
|
||||
return qfs.Build(cryptoData)
|
||||
}
|
||||
return p.uSpec.InitialPacketSpec.FrameBuilder.Build(cryptoData)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue