diff --git a/packet_packer.go b/packet_packer.go index d26385fd..acd3e724 100644 --- a/packet_packer.go +++ b/packet_packer.go @@ -57,7 +57,7 @@ func (p *packetPacker) PackPacket(stopWaitingFrame *frames.StopWaitingFrame, con )) packetNumberLen := protocol.GetPacketNumberLengthForPublicHeader(currentPacketNumber, p.sentPacketHandler.GetLargestObserved()) - responsePublicHeader := &PublicHeader{ + responsePublicHeader := &publicHeader{ ConnectionID: p.connectionID, PacketNumber: currentPacketNumber, PacketNumberLen: packetNumberLen, diff --git a/packet_unpacker.go b/packet_unpacker.go index 09924b4b..524a4b03 100644 --- a/packet_unpacker.go +++ b/packet_unpacker.go @@ -22,9 +22,9 @@ type packetUnpacker struct { aead crypto.AEAD } -func (u *packetUnpacker) Unpack(publicHeaderBinary []byte, publicHeader *PublicHeader, r *bytes.Reader) (*unpackedPacket, error) { +func (u *packetUnpacker) Unpack(publicHeaderBinary []byte, hdr *publicHeader, r *bytes.Reader) (*unpackedPacket, error) { ciphertext, _ := ioutil.ReadAll(r) - plaintext, err := u.aead.Open(publicHeader.PacketNumber, publicHeaderBinary, ciphertext) + plaintext, err := u.aead.Open(hdr.PacketNumber, publicHeaderBinary, ciphertext) if err != nil { // Wrap err in quicError so that public reset is sent by session return nil, protocol.NewQuicError(errorcodes.QUIC_DECRYPTION_FAILURE, err.Error()) @@ -67,7 +67,7 @@ ReadLoop: case 0x05: frame, err = frames.ParseBlockedFrame(r) case 0x06: - frame, err = frames.ParseStopWaitingFrame(r, publicHeader.PacketNumber, publicHeader.PacketNumberLen) + frame, err = frames.ParseStopWaitingFrame(r, hdr.PacketNumber, hdr.PacketNumberLen) case 0x07: frame, err = frames.ParsePingFrame(r) default: diff --git a/packet_unpacker_test.go b/packet_unpacker_test.go index 47ff0db7..3ea96d91 100644 --- a/packet_unpacker_test.go +++ b/packet_unpacker_test.go @@ -14,7 +14,7 @@ import ( var _ = Describe("Packet unpacker", func() { var ( unpacker *packetUnpacker - hdr *PublicHeader + hdr *publicHeader hdrBin []byte aead crypto.AEAD r *bytes.Reader @@ -23,7 +23,7 @@ var _ = Describe("Packet unpacker", func() { BeforeEach(func() { aead = &crypto.NullAEAD{} - hdr = &PublicHeader{ + hdr = &publicHeader{ PacketNumber: 10, PacketNumberLen: 1, } diff --git a/protocol/packet_number_test.go b/protocol/packet_number_test.go index c803cee4..1dd4905e 100644 --- a/protocol/packet_number_test.go +++ b/protocol/packet_number_test.go @@ -128,7 +128,7 @@ var _ = Describe("packet number calculation", func() { } }) - Context("shortening a packet number for the PublicHeader", func() { + Context("shortening a packet number for the publicHeader", func() { Context("shortening", func() { It("sends out low packet numbers as 1 byte", func() { length := GetPacketNumberLengthForPublicHeader(4, 2) diff --git a/public_header.go b/public_header.go index ec6e1579..f4600b81 100644 --- a/public_header.go +++ b/public_header.go @@ -17,8 +17,8 @@ var ( errGetLengthOnlyForRegularPackets = errors.New("PublicHeader: GetLength can only be called for regular packets") ) -// The PublicHeader of a QUIC packet -type PublicHeader struct { +// The publicHeader of a QUIC packet +type publicHeader struct { Raw []byte VersionFlag bool ResetFlag bool @@ -31,7 +31,7 @@ type PublicHeader struct { } // WritePublicHeader writes a public header -func (h *PublicHeader) WritePublicHeader(b *bytes.Buffer) error { +func (h *publicHeader) WritePublicHeader(b *bytes.Buffer) error { publicFlagByte := uint8(0x04) if h.VersionFlag && h.ResetFlag { return errResetAndVersionFlagSet @@ -84,8 +84,8 @@ func (h *PublicHeader) WritePublicHeader(b *bytes.Buffer) error { } // ParsePublicHeader parses a QUIC packet's public header -func ParsePublicHeader(b io.ByteReader) (*PublicHeader, error) { - header := &PublicHeader{} +func ParsePublicHeader(b io.ByteReader) (*publicHeader, error) { + header := &publicHeader{} // First byte publicFlagByte, err := b.ReadByte() @@ -145,9 +145,9 @@ func ParsePublicHeader(b io.ByteReader) (*PublicHeader, error) { return header, nil } -// GetLength gets the length of the PublicHeader in bytes +// GetLength gets the length of the publicHeader in bytes // can only be called for regular packets -func (h *PublicHeader) GetLength() (protocol.ByteCount, error) { +func (h *publicHeader) GetLength() (protocol.ByteCount, error) { if h.VersionFlag || h.ResetFlag { return 0, errGetLengthOnlyForRegularPackets } diff --git a/public_header_test.go b/public_header_test.go index 8a2c3445..8743dbd0 100644 --- a/public_header_test.go +++ b/public_header_test.go @@ -12,13 +12,13 @@ var _ = Describe("Public Header", func() { Context("when parsing", func() { It("accepts a sample client header", func() { b := bytes.NewReader([]byte{0x09, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0x51, 0x30, 0x33, 0x30, 0x01}) - publicHeader, err := ParsePublicHeader(b) + hdr, err := ParsePublicHeader(b) Expect(err).ToNot(HaveOccurred()) - Expect(publicHeader.VersionFlag).To(BeTrue()) - Expect(publicHeader.ResetFlag).To(BeFalse()) - Expect(publicHeader.ConnectionID).To(Equal(protocol.ConnectionID(0x4cfa9f9b668619f6))) - Expect(publicHeader.VersionNumber).To(Equal(protocol.VersionNumber(30))) - Expect(publicHeader.PacketNumber).To(Equal(protocol.PacketNumber(1))) + Expect(hdr.VersionFlag).To(BeTrue()) + Expect(hdr.ResetFlag).To(BeFalse()) + Expect(hdr.ConnectionID).To(Equal(protocol.ConnectionID(0x4cfa9f9b668619f6))) + Expect(hdr.VersionNumber).To(Equal(protocol.VersionNumber(30))) + Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(1))) Expect(b.Len()).To(BeZero()) }) @@ -38,33 +38,33 @@ var _ = Describe("Public Header", func() { It("accepts 1-byte packet numbers", func() { b := bytes.NewReader([]byte{0x08, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xde}) - publicHeader, err := ParsePublicHeader(b) + hdr, err := ParsePublicHeader(b) Expect(err).ToNot(HaveOccurred()) - Expect(publicHeader.PacketNumber).To(Equal(protocol.PacketNumber(0xde))) + Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xde))) Expect(b.Len()).To(BeZero()) }) It("accepts 2-byte packet numbers", func() { b := bytes.NewReader([]byte{0x18, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xde, 0xca}) - publicHeader, err := ParsePublicHeader(b) + hdr, err := ParsePublicHeader(b) Expect(err).ToNot(HaveOccurred()) - Expect(publicHeader.PacketNumber).To(Equal(protocol.PacketNumber(0xcade))) + Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xcade))) Expect(b.Len()).To(BeZero()) }) It("accepts 4-byte packet numbers", func() { b := bytes.NewReader([]byte{0x28, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xad, 0xfb, 0xca, 0xde}) - publicHeader, err := ParsePublicHeader(b) + hdr, err := ParsePublicHeader(b) Expect(err).ToNot(HaveOccurred()) - Expect(publicHeader.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad))) + Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad))) Expect(b.Len()).To(BeZero()) }) It("accepts 6-byte packet numbers", func() { b := bytes.NewReader([]byte{0x38, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0x23, 0x42, 0xad, 0xfb, 0xca, 0xde}) - publicHeader, err := ParsePublicHeader(b) + hdr, err := ParsePublicHeader(b) Expect(err).ToNot(HaveOccurred()) - Expect(publicHeader.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad4223))) + Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad4223))) Expect(b.Len()).To(BeZero()) }) @@ -81,24 +81,24 @@ var _ = Describe("Public Header", func() { Context("when writing", func() { It("writes a sample header", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 2, PacketNumberLen: protocol.PacketNumberLen6, } - publicHeader.WritePublicHeader(b) + hdr.WritePublicHeader(b) Expect(b.Bytes()).To(Equal([]byte{0x38 | 0x04, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 2, 0, 0, 0, 0, 0})) }) It("sets the Version Flag", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ VersionFlag: true, ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 2, PacketNumberLen: protocol.PacketNumberLen6, } - publicHeader.WritePublicHeader(b) + hdr.WritePublicHeader(b) // must be the first assertion Expect(b.Len()).To(Equal(1 + 8)) // 1 FlagByte + 8 ConnectionID firstByte, _ := b.ReadByte() @@ -107,13 +107,13 @@ var _ = Describe("Public Header", func() { It("sets the Reset Flag", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ResetFlag: true, ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 2, PacketNumberLen: protocol.PacketNumberLen6, } - publicHeader.WritePublicHeader(b) + hdr.WritePublicHeader(b) // must be the first assertion Expect(b.Len()).To(Equal(1 + 8)) // 1 FlagByte + 8 ConnectionID firstByte, _ := b.ReadByte() @@ -122,26 +122,26 @@ var _ = Describe("Public Header", func() { It("throws an error if both Reset Flag and Version Flag are set", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ VersionFlag: true, ResetFlag: true, ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 2, PacketNumberLen: protocol.PacketNumberLen6, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(errResetAndVersionFlagSet)) }) It("truncates the connection ID", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, TruncateConnectionID: true, PacketNumberLen: protocol.PacketNumberLen6, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).ToNot(HaveOccurred()) firstByte, _ := b.ReadByte() Expect(firstByte & 0x08).To(BeZero()) @@ -150,59 +150,59 @@ var _ = Describe("Public Header", func() { Context("GetLength", func() { It("errors when calling GetLength for Version Negotiation packets", func() { - publicHeader := PublicHeader{VersionFlag: true} - _, err := publicHeader.GetLength() + hdr := publicHeader{VersionFlag: true} + _, err := hdr.GetLength() Expect(err).To(HaveOccurred()) Expect(err).To(Equal(errGetLengthOnlyForRegularPackets)) }) It("errors when calling GetLength for Public Reset packets", func() { - publicHeader := PublicHeader{ResetFlag: true} - _, err := publicHeader.GetLength() + hdr := publicHeader{ResetFlag: true} + _, err := hdr.GetLength() Expect(err).To(HaveOccurred()) Expect(err).To(Equal(errGetLengthOnlyForRegularPackets)) }) It("errors when PacketNumberLen is not set", func() { - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, } - _, err := publicHeader.GetLength() + _, err := hdr.GetLength() Expect(err).To(HaveOccurred()) Expect(err).To(Equal(errPacketNumberLenNotSet)) }) It("gets the length of a packet with longest packet number length and connectionID", func() { - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, PacketNumberLen: protocol.PacketNumberLen6, } - length, err := publicHeader.GetLength() + length, err := hdr.GetLength() Expect(err).ToNot(HaveOccurred()) Expect(length).To(Equal(protocol.ByteCount(1 + 8 + 6))) // 1 byte public flag, 8 bytes connectionID, and packet number }) It("gets the length of a packet with longest packet number length and truncated connectionID", func() { - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, TruncateConnectionID: true, PacketNumber: 0xDECAFBAD, PacketNumberLen: protocol.PacketNumberLen6, } - length, err := publicHeader.GetLength() + length, err := hdr.GetLength() Expect(err).ToNot(HaveOccurred()) Expect(length).To(Equal(protocol.ByteCount(1 + 6))) // 1 byte public flag, and packet number }) It("gets the length of a packet 2 byte packet number length ", func() { - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, PacketNumberLen: protocol.PacketNumberLen2, } - length, err := publicHeader.GetLength() + length, err := hdr.GetLength() Expect(err).ToNot(HaveOccurred()) Expect(length).To(Equal(protocol.ByteCount(1 + 8 + 2))) // 1 byte public flag, 8 byte connectionID, and packet number }) @@ -211,59 +211,59 @@ var _ = Describe("Public Header", func() { Context("packet number length", func() { It("doesn't write a header if the packet number length is not set", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).To(HaveOccurred()) Expect(err).To(Equal(errPacketNumberLenNotSet)) }) It("writes a header with a 1-byte packet number", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, PacketNumberLen: protocol.PacketNumberLen1, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).ToNot(HaveOccurred()) Expect(b.Bytes()).To(Equal([]byte{0x08 | 0x04, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xAD})) }) It("writes a header with a 2-byte packet number", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xDECAFBAD, PacketNumberLen: protocol.PacketNumberLen2, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).ToNot(HaveOccurred()) Expect(b.Bytes()).To(Equal([]byte{0x18 | 0x04, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xAD, 0xFB})) }) It("writes a header with a 4-byte packet number", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0x13DECAFBAD, PacketNumberLen: protocol.PacketNumberLen4, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).ToNot(HaveOccurred()) Expect(b.Bytes()).To(Equal([]byte{0x28 | 0x04, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xAD, 0xFB, 0xCA, 0xDE})) }) It("writes a header with a 6-byte packet number", func() { b := &bytes.Buffer{} - publicHeader := PublicHeader{ + hdr := publicHeader{ ConnectionID: 0x4cfa9f9b668619f6, PacketNumber: 0xBE1337DECAFBAD, PacketNumberLen: protocol.PacketNumberLen6, } - err := publicHeader.WritePublicHeader(b) + err := hdr.WritePublicHeader(b) Expect(err).ToNot(HaveOccurred()) Expect(b.Bytes()).To(Equal([]byte{0x38 | 0x04, 0xf6, 0x19, 0x86, 0x66, 0x9b, 0x9f, 0xfa, 0x4c, 0xAD, 0xFB, 0xCA, 0xDE, 0x37, 0x13})) }) diff --git a/server.go b/server.go index 55932be7..26be1d61 100644 --- a/server.go +++ b/server.go @@ -14,7 +14,7 @@ import ( // packetHandler handles packets type packetHandler interface { - HandlePacket(addr interface{}, publicHeader *PublicHeader, data []byte) + HandlePacket(addr interface{}, hdr *publicHeader, data []byte) Run() } @@ -97,17 +97,17 @@ func (s *Server) handlePacket(conn *net.UDPConn, remoteAddr *net.UDPAddr, packet r := bytes.NewReader(packet) // ToDo: check packet size and send errorcodes.QUIC_PACKET_TOO_LARGE if packet is too large - publicHeader, err := ParsePublicHeader(r) + hdr, err := ParsePublicHeader(r) if err != nil { // ToDo: send errorcodes.QUIC_INVALID_PACKET_HEADER return err } - publicHeader.Raw = packet[:len(packet)-r.Len()] + hdr.Raw = packet[:len(packet)-r.Len()] // Send Version Negotiation Packet if the client is speaking a different protocol version - if publicHeader.VersionFlag && !protocol.IsSupportedVersion(publicHeader.VersionNumber) { - utils.Infof("Client offered version %d, sending VersionNegotiationPacket", publicHeader.VersionNumber) - _, err = conn.WriteToUDP(composeVersionNegotiation(publicHeader.ConnectionID), remoteAddr) + if hdr.VersionFlag && !protocol.IsSupportedVersion(hdr.VersionNumber) { + utils.Infof("Client offered version %d, sending VersionNegotiationPacket", hdr.VersionNumber) + _, err = conn.WriteToUDP(composeVersionNegotiation(hdr.ConnectionID), remoteAddr) if err != nil { return err } @@ -115,29 +115,29 @@ func (s *Server) handlePacket(conn *net.UDPConn, remoteAddr *net.UDPAddr, packet } s.sessionsMutex.RLock() - session, ok := s.sessions[publicHeader.ConnectionID] + session, ok := s.sessions[hdr.ConnectionID] s.sessionsMutex.RUnlock() if !ok { - utils.Infof("Serving new connection: %x, version %d from %v", publicHeader.ConnectionID, publicHeader.VersionNumber, remoteAddr) + utils.Infof("Serving new connection: %x, version %d from %v", hdr.ConnectionID, hdr.VersionNumber, remoteAddr) session = s.newSession( &udpConn{conn: conn, currentAddr: remoteAddr}, - publicHeader.VersionNumber, - publicHeader.ConnectionID, + hdr.VersionNumber, + hdr.ConnectionID, s.scfg, s.streamCallback, s.closeCallback, ) go session.Run() s.sessionsMutex.Lock() - s.sessions[publicHeader.ConnectionID] = session + s.sessions[hdr.ConnectionID] = session s.sessionsMutex.Unlock() } if session == nil { // Late packet for closed session return nil } - session.HandlePacket(remoteAddr, publicHeader, packet[len(packet)-r.Len():]) + session.HandlePacket(remoteAddr, hdr, packet[len(packet)-r.Len():]) return nil } @@ -149,7 +149,7 @@ func (s *Server) closeCallback(id protocol.ConnectionID) { func composeVersionNegotiation(connectionID protocol.ConnectionID) []byte { fullReply := &bytes.Buffer{} - responsePublicHeader := PublicHeader{ + responsePublicHeader := publicHeader{ ConnectionID: connectionID, PacketNumber: 1, VersionFlag: true, diff --git a/server_test.go b/server_test.go index 82f6d735..be892fce 100644 --- a/server_test.go +++ b/server_test.go @@ -18,7 +18,7 @@ type mockSession struct { packetCount int } -func (s *mockSession) HandlePacket(addr interface{}, publicHeader *PublicHeader, data []byte) { +func (s *mockSession) HandlePacket(addr interface{}, hdr *publicHeader, data []byte) { s.packetCount++ } diff --git a/session.go b/session.go index 5da7fbb5..ffe59ebd 100644 --- a/session.go +++ b/session.go @@ -18,7 +18,7 @@ import ( type receivedPacket struct { remoteAddr interface{} - publicHeader *PublicHeader + publicHeader *publicHeader data []byte } @@ -181,27 +181,27 @@ func (s *Session) Run() { } } -func (s *Session) handlePacket(remoteAddr interface{}, publicHeader *PublicHeader, data []byte) error { +func (s *Session) handlePacket(remoteAddr interface{}, hdr *publicHeader, data []byte) error { r := bytes.NewReader(data) - // Calcualate packet number - publicHeader.PacketNumber = protocol.InferPacketNumber( - publicHeader.PacketNumberLen, + // Calculate packet number + hdr.PacketNumber = protocol.InferPacketNumber( + hdr.PacketNumberLen, s.lastRcvdPacketNumber, - publicHeader.PacketNumber, + hdr.PacketNumber, ) - s.lastRcvdPacketNumber = publicHeader.PacketNumber - utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x", publicHeader.PacketNumber, r.Size(), publicHeader.ConnectionID) + s.lastRcvdPacketNumber = hdr.PacketNumber + utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x", hdr.PacketNumber, r.Size(), hdr.ConnectionID) // TODO: Only do this after authenticating s.conn.setCurrentRemoteAddr(remoteAddr) - packet, err := s.unpacker.Unpack(publicHeader.Raw, publicHeader, r) + packet, err := s.unpacker.Unpack(hdr.Raw, hdr, r) if err != nil { return err } - s.receivedPacketHandler.ReceivedPacket(publicHeader.PacketNumber, packet.entropyBit) + s.receivedPacketHandler.ReceivedPacket(hdr.PacketNumber, packet.entropyBit) for _, ff := range packet.frames { var err error @@ -240,8 +240,8 @@ func (s *Session) handlePacket(remoteAddr interface{}, publicHeader *PublicHeade } // HandlePacket handles a packet -func (s *Session) HandlePacket(remoteAddr interface{}, publicHeader *PublicHeader, data []byte) { - s.receivedPackets <- receivedPacket{remoteAddr: remoteAddr, publicHeader: publicHeader, data: data} +func (s *Session) HandlePacket(remoteAddr interface{}, hdr *publicHeader, data []byte) { + s.receivedPackets <- receivedPacket{remoteAddr: remoteAddr, publicHeader: hdr, data: data} } // TODO: Ignore data for closed streams diff --git a/session_test.go b/session_test.go index b8c8ba23..b58c1aa7 100644 --- a/session_test.go +++ b/session_test.go @@ -431,7 +431,7 @@ var _ = Describe("Session", func() { It("sends after receiving a packet", func() { Expect(session.sendingScheduled).NotTo(Receive()) session.receivedPackets <- receivedPacket{ - publicHeader: &PublicHeader{}, + publicHeader: &publicHeader{}, data: []byte{ // FNV hash + "foobar" 0x18, 0x6f, 0x44, 0xba, 0x97, 0x35, 0xd, 0x6f, 0xbf, 0x64, 0x3c, 0x79, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, @@ -535,7 +535,7 @@ var _ = Describe("Session", func() { // Write protocol.MaxUndecryptablePackets and expect a public reset to happen for i := 0; i < protocol.MaxUndecryptablePackets; i++ { - hdr := &PublicHeader{ + hdr := &publicHeader{ PacketNumber: protocol.PacketNumber(i + 1), } session.HandlePacket(nil, hdr, []byte("foobar")) @@ -553,7 +553,7 @@ var _ = Describe("Session", func() { session = newSession(conn, 0, 0, scfg, nil, func(protocol.ConnectionID) {}).(*Session) session.undecryptablePackets = []receivedPacket{{ nil, - &PublicHeader{PacketNumber: protocol.PacketNumber(42)}, + &publicHeader{PacketNumber: protocol.PacketNumber(42)}, nil, }} Expect(session.receivedPackets).NotTo(Receive())