From d1b461dca1abb697cb8dc3ba8999737e1c5a035d Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 21 Sep 2020 18:00:25 +0200 Subject: [PATCH] Convert 'supportedVersion' to a field in PacketHeader object --- quic/packets.nim | 23 ++++++++++++++--------- tests/quic/testPackets.nim | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/quic/packets.nim b/quic/packets.nim index eede9e5..c7ca618 100644 --- a/quic/packets.nim +++ b/quic/packets.nim @@ -23,7 +23,7 @@ type of packetInitial, packet0RTT, packetHandshake, packetRetry: version*: uint32 of packetVersionNegotiation: - discard + supportedVersion*: uint32 destination*: ConnectionId source*: ConnectionId bytes: seq[byte] @@ -94,6 +94,17 @@ proc findSource(datagram: seq[byte]): Slice[int] = proc readSource(datagram: seq[byte]): ConnectionId = result = ConnectionId(datagram[datagram.findSource()]) +proc findSupportedVersion(datagram: seq[byte]): Slice[int] = + let start = datagram.findSource().b + 1 + result = start..