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:
Gaukas Wang 2023-08-05 22:47:08 -06:00 committed by GitHub
parent 5e966a9bec
commit 9d3fe2aa07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1154 additions and 478 deletions

View file

@ -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)
}