mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
log connection IDs without the 0x prefix
This commit is contained in:
parent
0b97ae5632
commit
6ece64d8a5
6 changed files with 14 additions and 14 deletions
|
@ -65,5 +65,5 @@ func (c ConnectionID) String() string {
|
|||
if c.Len() == 0 {
|
||||
return "(empty)"
|
||||
}
|
||||
return fmt.Sprintf("%#x", c.Bytes())
|
||||
return fmt.Sprintf("%x", c.Bytes())
|
||||
}
|
||||
|
|
|
@ -93,12 +93,12 @@ var _ = Describe("Connection ID generation", func() {
|
|||
|
||||
It("has a string representation", func() {
|
||||
c := ConnectionID([]byte{0xde, 0xad, 0xbe, 0xef, 0x42})
|
||||
Expect(c.String()).To(Equal("0xdeadbeef42"))
|
||||
Expect(c.String()).To(Equal("deadbeef42"))
|
||||
})
|
||||
|
||||
It("has a long string representation", func() {
|
||||
c := ConnectionID{0x13, 0x37, 0, 0, 0xde, 0xca, 0xfb, 0xad}
|
||||
Expect(c.String()).To(Equal("0x13370000decafbad"))
|
||||
Expect(c.String()).To(Equal("13370000decafbad"))
|
||||
})
|
||||
|
||||
It("has a string representation for the default value", func() {
|
||||
|
|
|
@ -360,7 +360,7 @@ var _ = Describe("Header", func() {
|
|||
PacketNumber: 1337,
|
||||
PacketNumberLen: protocol.PacketNumberLen2,
|
||||
}).Log(logger)
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Handshake, DestConnectionID: 0xdeadbeefcafe1337, SrcConnectionID: 0xdecafbad13371337, PacketNumber: 1337, PacketNumberLen: 2, Length: 54321, Version: 0xfeed}"))
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Handshake, DestConnectionID: deadbeefcafe1337, SrcConnectionID: decafbad13371337, PacketNumber: 1337, PacketNumberLen: 2, Length: 54321, Version: 0xfeed}"))
|
||||
})
|
||||
|
||||
It("logs Initial Packets with a Token", func() {
|
||||
|
@ -377,7 +377,7 @@ var _ = Describe("Header", func() {
|
|||
PacketNumber: 42,
|
||||
PacketNumberLen: protocol.PacketNumberLen2,
|
||||
}).Log(logger)
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Initial, DestConnectionID: 0xcafe1337, SrcConnectionID: 0xdecafbad, Token: 0xdeadbeef, PacketNumber: 42, PacketNumberLen: 2, Length: 100, Version: 0xfeed}"))
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Initial, DestConnectionID: cafe1337, SrcConnectionID: decafbad, Token: 0xdeadbeef, PacketNumber: 42, PacketNumberLen: 2, Length: 100, Version: 0xfeed}"))
|
||||
})
|
||||
|
||||
It("logs Initial packets without a Token", func() {
|
||||
|
@ -393,7 +393,7 @@ var _ = Describe("Header", func() {
|
|||
PacketNumber: 42,
|
||||
PacketNumberLen: protocol.PacketNumberLen2,
|
||||
}).Log(logger)
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Initial, DestConnectionID: 0xcafe1337, SrcConnectionID: 0xdecafbad, Token: (empty), PacketNumber: 42, PacketNumberLen: 2, Length: 100, Version: 0xfeed}"))
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Initial, DestConnectionID: cafe1337, SrcConnectionID: decafbad, Token: (empty), PacketNumber: 42, PacketNumberLen: 2, Length: 100, Version: 0xfeed}"))
|
||||
})
|
||||
|
||||
It("logs Retry packets with a Token", func() {
|
||||
|
@ -407,7 +407,7 @@ var _ = Describe("Header", func() {
|
|||
Version: 0xfeed,
|
||||
},
|
||||
}).Log(logger)
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Retry, DestConnectionID: 0xcafe1337, SrcConnectionID: 0xdecafbad, Token: 0x123456, Version: 0xfeed}"))
|
||||
Expect(buf.String()).To(ContainSubstring("Long Header{Type: Retry, DestConnectionID: cafe1337, SrcConnectionID: decafbad, Token: 0x123456, Version: 0xfeed}"))
|
||||
})
|
||||
|
||||
It("logs Short Headers containing a connection ID", func() {
|
||||
|
@ -419,7 +419,7 @@ var _ = Describe("Header", func() {
|
|||
PacketNumber: 1337,
|
||||
PacketNumberLen: 4,
|
||||
}).Log(logger)
|
||||
Expect(buf.String()).To(ContainSubstring("Short Header{DestConnectionID: 0xdeadbeefcafe1337, PacketNumber: 1337, PacketNumberLen: 4, KeyPhase: 1}"))
|
||||
Expect(buf.String()).To(ContainSubstring("Short Header{DestConnectionID: deadbeefcafe1337, PacketNumber: 1337, PacketNumberLen: 4, KeyPhase: 1}"))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -156,7 +156,7 @@ var _ = Describe("Frame logging", func() {
|
|||
ConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
|
||||
StatelessResetToken: protocol.StatelessResetToken{0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10},
|
||||
}, false)
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.NewConnectionIDFrame{SequenceNumber: 42, ConnectionID: 0xdeadbeef, StatelessResetToken: 0x0102030405060708090a0b0c0d0e0f10}"))
|
||||
Expect(buf.String()).To(ContainSubstring("\t<- &wire.NewConnectionIDFrame{SequenceNumber: 42, ConnectionID: deadbeef, StatelessResetToken: 0x0102030405060708090a0b0c0d0e0f10}"))
|
||||
})
|
||||
|
||||
It("logs NEW_TOKEN frames", func() {
|
||||
|
|
|
@ -57,7 +57,7 @@ var _ = Describe("Transport Parameters", func() {
|
|||
ActiveConnectionIDLimit: 123,
|
||||
MaxDatagramFrameSize: 876,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: 0xdeadbeef, InitialSourceConnectionID: 0xdecafbad, RetrySourceConnectionID: 0xdeadc0de, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37ms, ActiveConnectionIDLimit: 123, StatelessResetToken: 0x112233445566778899aabbccddeeff00, MaxDatagramFrameSize: 876}"))
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: deadbeef, InitialSourceConnectionID: decafbad, RetrySourceConnectionID: deadc0de, InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37ms, ActiveConnectionIDLimit: 123, StatelessResetToken: 0x112233445566778899aabbccddeeff00, MaxDatagramFrameSize: 876}"))
|
||||
})
|
||||
|
||||
It("has a string representation, if there's no stateless reset token, no Retry source connection id and no datagram support", func() {
|
||||
|
@ -76,7 +76,7 @@ var _ = Describe("Transport Parameters", func() {
|
|||
ActiveConnectionIDLimit: 89,
|
||||
MaxDatagramFrameSize: protocol.InvalidByteCount,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: 0xdeadbeef, InitialSourceConnectionID: (empty), InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37s, ActiveConnectionIDLimit: 89}"))
|
||||
Expect(p.String()).To(Equal("&wire.TransportParameters{OriginalDestinationConnectionID: deadbeef, InitialSourceConnectionID: (empty), InitialMaxStreamDataBidiLocal: 1234, InitialMaxStreamDataBidiRemote: 2345, InitialMaxStreamDataUni: 3456, InitialMaxData: 4567, MaxBidiStreamNum: 1337, MaxUniStreamNum: 7331, MaxIdleTimeout: 42s, AckDelayExponent: 14, MaxAckDelay: 37s, ActiveConnectionIDLimit: 89}"))
|
||||
})
|
||||
|
||||
It("marshals and unmarshals", func() {
|
||||
|
|
|
@ -2745,7 +2745,7 @@ var _ = Describe("Client Session", func() {
|
|||
expectClose()
|
||||
tracer.EXPECT().ReceivedTransportParameters(params)
|
||||
sess.processTransportParameters(params)
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected initial_source_connection_id to equal 0xdeadbeef, is 0xdecafbad")))
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected initial_source_connection_id to equal deadbeef, is decafbad")))
|
||||
})
|
||||
|
||||
It("errors if the transport parameters don't contain the retry_source_connection_id, if a Retry was performed", func() {
|
||||
|
@ -2772,7 +2772,7 @@ var _ = Describe("Client Session", func() {
|
|||
expectClose()
|
||||
tracer.EXPECT().ReceivedTransportParameters(params)
|
||||
sess.processTransportParameters(params)
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected retry_source_connection_id to equal 0xdeadbeef, is 0xdeadc0de")))
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected retry_source_connection_id to equal deadbeef, is deadc0de")))
|
||||
})
|
||||
|
||||
It("errors if the transport parameters contain the retry_source_connection_id, if no Retry was performed", func() {
|
||||
|
@ -2798,7 +2798,7 @@ var _ = Describe("Client Session", func() {
|
|||
expectClose()
|
||||
tracer.EXPECT().ReceivedTransportParameters(params)
|
||||
sess.processTransportParameters(params)
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_destination_connection_id to equal 0xdeadbeef, is 0xdecafbad")))
|
||||
Eventually(errChan).Should(Receive(MatchError("TRANSPORT_PARAMETER_ERROR: expected original_destination_connection_id to equal deadbeef, is decafbad")))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue