create a milestone version for 0.8.0

This commit is contained in:
Marten Seemann
2018-06-23 13:33:31 +07:00
parent 3f9212b5f7
commit deffae864a
3 changed files with 27 additions and 8 deletions

View File

@@ -19,6 +19,9 @@ type VersionNumber = protocol.VersionNumber
// VersionGQUIC39 is gQUIC version 39.
const VersionGQUIC39 = protocol.Version39
// VersionMilestone0_8_0 uses TLS
const VersionMilestone0_8_0 = protocol.VersionMilestone0_8_0
// A Cookie can be used to verify the ownership of the client address.
type Cookie = handshake.Cookie

View File

@@ -18,12 +18,13 @@ const (
// The version numbers, making grepping easier
const (
Version39 VersionNumber = gquicVersion0 + 3*0x100 + 0x9
Version42 VersionNumber = gquicVersion0 + 4*0x100 + 0x2
Version43 VersionNumber = gquicVersion0 + 4*0x100 + 0x3
VersionTLS VersionNumber = 101
VersionWhatever VersionNumber = 0 // for when the version doesn't matter
VersionUnknown VersionNumber = math.MaxUint32
Version39 VersionNumber = gquicVersion0 + 3*0x100 + 0x9
Version42 VersionNumber = gquicVersion0 + 4*0x100 + 0x2
Version43 VersionNumber = gquicVersion0 + 4*0x100 + 0x3
VersionTLS VersionNumber = 101
VersionWhatever VersionNumber = 0 // for when the version doesn't matter
VersionUnknown VersionNumber = math.MaxUint32
VersionMilestone0_8_0 VersionNumber = 0x51474f00
)
// SupportedVersions lists the versions that the server supports
@@ -36,12 +37,12 @@ var SupportedVersions = []VersionNumber{
// IsValidVersion says if the version is known to quic-go
func IsValidVersion(v VersionNumber) bool {
return v == VersionTLS || IsSupportedVersion(SupportedVersions, v)
return v == VersionTLS || v == VersionMilestone0_8_0 || IsSupportedVersion(SupportedVersions, v)
}
// UsesTLS says if this QUIC version uses TLS 1.3 for the handshake
func (vn VersionNumber) UsesTLS() bool {
return vn == VersionTLS
return vn == VersionTLS || vn == VersionMilestone0_8_0
}
func (vn VersionNumber) String() string {
@@ -52,6 +53,8 @@ func (vn VersionNumber) String() string {
return "unknown"
case VersionTLS:
return "TLS dev version (WIP)"
case VersionMilestone0_8_0:
return "quic-go Milestone 0.8.0"
default:
if vn.isGQUIC() {
return fmt.Sprintf("gQUIC %d", vn.toGQUICVersion())

View File

@@ -22,6 +22,7 @@ var _ = Describe("Version", func() {
Expect(IsValidVersion(Version42)).To(BeTrue())
Expect(IsValidVersion(Version43)).To(BeTrue())
Expect(IsValidVersion(VersionTLS)).To(BeTrue())
Expect(IsValidVersion(VersionMilestone0_8_0)).To(BeTrue())
Expect(IsValidVersion(VersionWhatever)).To(BeFalse())
Expect(IsValidVersion(VersionUnknown)).To(BeFalse())
Expect(IsValidVersion(1234)).To(BeFalse())
@@ -32,6 +33,7 @@ var _ = Describe("Version", func() {
Expect(Version42.UsesTLS()).To(BeFalse())
Expect(Version43.UsesTLS()).To(BeFalse())
Expect(VersionTLS.UsesTLS()).To(BeTrue())
Expect(VersionMilestone0_8_0.UsesTLS()).To(BeTrue())
})
It("versions don't have reserved version numbers", func() {
@@ -39,11 +41,13 @@ var _ = Describe("Version", func() {
Expect(isReservedVersion(Version42)).To(BeFalse())
Expect(isReservedVersion(Version43)).To(BeFalse())
Expect(isReservedVersion(VersionTLS)).To(BeFalse())
Expect(isReservedVersion(VersionMilestone0_8_0)).To(BeFalse())
})
It("has the right string representation", func() {
Expect(Version39.String()).To(Equal("gQUIC 39"))
Expect(VersionTLS.String()).To(ContainSubstring("TLS"))
Expect(VersionMilestone0_8_0.String()).To(ContainSubstring("quic-go Milestone 0.8.0"))
Expect(VersionWhatever.String()).To(Equal("whatever"))
Expect(VersionUnknown.String()).To(Equal("unknown"))
// check with unsupported version numbers from the wiki
@@ -70,6 +74,7 @@ var _ = Describe("Version", func() {
Expect(Version42.CryptoStreamID()).To(Equal(StreamID(1)))
Expect(Version43.CryptoStreamID()).To(Equal(StreamID(1)))
Expect(VersionTLS.CryptoStreamID()).To(Equal(StreamID(0)))
Expect(VersionMilestone0_8_0.CryptoStreamID()).To(Equal(StreamID(0)))
})
It("tells if a version uses the IETF frame types", func() {
@@ -77,6 +82,7 @@ var _ = Describe("Version", func() {
Expect(Version42.UsesIETFFrameFormat()).To(BeFalse())
Expect(Version43.UsesIETFFrameFormat()).To(BeFalse())
Expect(VersionTLS.UsesIETFFrameFormat()).To(BeTrue())
Expect(VersionMilestone0_8_0.UsesIETFFrameFormat()).To(BeTrue())
})
It("tells if a version uses varint packet numbers", func() {
@@ -84,6 +90,7 @@ var _ = Describe("Version", func() {
Expect(Version42.UsesVarintPacketNumbers()).To(BeFalse())
Expect(Version43.UsesVarintPacketNumbers()).To(BeFalse())
Expect(VersionTLS.UsesVarintPacketNumbers()).To(BeTrue())
Expect(VersionMilestone0_8_0.UsesVarintPacketNumbers()).To(BeTrue())
})
It("tells if a version uses the IETF frame types", func() {
@@ -91,6 +98,7 @@ var _ = Describe("Version", func() {
Expect(Version42.UsesIETFFrameFormat()).To(BeFalse())
Expect(Version43.UsesIETFFrameFormat()).To(BeFalse())
Expect(VersionTLS.UsesIETFFrameFormat()).To(BeTrue())
Expect(VersionMilestone0_8_0.UsesIETFFrameFormat()).To(BeTrue())
})
It("tells if a version uses STOP_WAITING frames", func() {
@@ -98,6 +106,7 @@ var _ = Describe("Version", func() {
Expect(Version42.UsesStopWaitingFrames()).To(BeTrue())
Expect(Version43.UsesStopWaitingFrames()).To(BeTrue())
Expect(VersionTLS.UsesStopWaitingFrames()).To(BeFalse())
Expect(VersionMilestone0_8_0.UsesStopWaitingFrames()).To(BeFalse())
})
It("says if a stream contributes to connection-level flowcontrol, for gQUIC", func() {
@@ -116,6 +125,10 @@ var _ = Describe("Version", func() {
Expect(VersionTLS.StreamContributesToConnectionFlowControl(1)).To(BeTrue())
Expect(VersionTLS.StreamContributesToConnectionFlowControl(2)).To(BeTrue())
Expect(VersionTLS.StreamContributesToConnectionFlowControl(3)).To(BeTrue())
Expect(VersionMilestone0_8_0.StreamContributesToConnectionFlowControl(0)).To(BeFalse())
Expect(VersionMilestone0_8_0.StreamContributesToConnectionFlowControl(1)).To(BeTrue())
Expect(VersionMilestone0_8_0.StreamContributesToConnectionFlowControl(2)).To(BeTrue())
Expect(VersionMilestone0_8_0.StreamContributesToConnectionFlowControl(3)).To(BeTrue())
})
It("recognizes supported versions", func() {