Skip to content

Commit

Permalink
make the version number a uint32
Browse files Browse the repository at this point in the history
This will allow us to set it to the IETF draft version numbers as listed
in https://github.com/quicwg/base-drafts/wiki/QUIC-Versions. Those
numbers would overflow a int32.
  • Loading branch information
marten-seemann committed Feb 21, 2018
1 parent d191449 commit 3371d6b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/protocol/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"crypto/rand"
"encoding/binary"
"fmt"
"math"
)

// VersionNumber is a version number as int
type VersionNumber int32
type VersionNumber uint32

// gQUIC version range as defined in the wiki: https://github.com/quicwg/base-drafts/wiki/QUIC-Versions
const (
Expand All @@ -20,7 +21,7 @@ const (
Version39 VersionNumber = gquicVersion0 + 3*0x100 + 0x9 + iota
VersionTLS VersionNumber = 101
VersionWhatever VersionNumber = 0 // for when the version doesn't matter
VersionUnknown VersionNumber = -1
VersionUnknown VersionNumber = math.MaxUint32
)

// SupportedVersions lists the versions that the server supports
Expand Down

0 comments on commit 3371d6b

Please sign in to comment.