ekr / minq

A simple Go implementation of QUIC
MIT License
98 stars 16 forks source link

Packet header changes for -11 #67

Closed martinthomson closed 6 years ago

martinthomson commented 6 years ago

Getting the packet header decoding working was a little difficult. In the end I opted to partially teach your codec about tls:"varint" so that I could encode the packet number (the alternative was to encode it as two octets always, which was tempting, but would have made decoding hard still). I'm not happy with the way that I am decoding the short packet header, but it's the best I could come up with on short notice. If you have a better idea, I'd really like to hear it.

I updated the per-version salt, bumped the packet number, changed the calculation of per-packet overheads (it makes more sense to do that with a variable-length connection ID).

It might make sense to have configuration for the length of the connection ID, but I hard-coded that to 8 for now. You don't have any means of configuring a connection/server, so that seemed hard enough that I wanted to punt on it.

There are three connection ID fields in Connection now, the initial is saved separate to client/server CIDs. Using those simplified things a bit, so I refactored some code around sending packets, especially version negotiation, which had a special function that I just inlined since VN was the only user. Also, in using those new fields, I noticed that there was an entirely unused function, which is now gone.

martinthomson commented 6 years ago

This is https://phabricator.services.mozilla.com/D1274

ekr commented 6 years ago

You may want to fix this conflict.