mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-06 05:37:36 +03:00
add entropy accumulation
This commit is contained in:
parent
284b86c02c
commit
59ed21e690
5 changed files with 48 additions and 6 deletions
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -65,9 +64,8 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
if privateFlag&0x02 > 0 || privateFlag&0x04 > 0 {
|
||||
panic(errors.New("FEC packets are not implemented"))
|
||||
}
|
||||
var entropyAcc quic.EntropyAccumulator
|
||||
entropyAcc.Add(publicHeader.PacketNumber, privateFlag&0x01 > 0)
|
||||
|
||||
frame, err := quic.ParseStreamFrame(r)
|
||||
if err != nil {
|
||||
|
@ -109,6 +107,7 @@ func main() {
|
|||
replyFrame := &bytes.Buffer{}
|
||||
replyFrame.WriteByte(0) // Private header
|
||||
quic.WriteAckFrame(replyFrame, &quic.AckFrame{
|
||||
Entropy: entropyAcc.Get(),
|
||||
LargestObserved: 1,
|
||||
})
|
||||
quic.WriteStreamFrame(replyFrame, &quic.StreamFrame{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue