don't pass the QUIC version to the StartedConnection event

The version might change in response to a Version Negotiation packet.
This commit is contained in:
Marten Seemann
2021-03-21 18:05:05 +08:00
parent ea14ce5724
commit c30a45ef6f
14 changed files with 34 additions and 47 deletions

View File

@@ -59,11 +59,8 @@ type eventConnectionStarted struct {
SrcAddr *net.UDPAddr
DestAddr *net.UDPAddr
Version protocol.VersionNumber
SrcConnectionID protocol.ConnectionID
DestConnectionID protocol.ConnectionID
// TODO: add ALPN
}
var _ eventDetails = &eventConnectionStarted{}
@@ -82,7 +79,6 @@ func (e eventConnectionStarted) MarshalJSONObject(enc *gojay.Encoder) {
enc.IntKey("src_port", e.SrcAddr.Port)
enc.StringKey("dst_ip", e.DestAddr.IP.String())
enc.IntKey("dst_port", e.DestAddr.Port)
enc.StringKey("quic_version", versionNumber(e.Version).String())
enc.StringKey("src_cid", connectionID(e.SrcConnectionID).String())
enc.StringKey("dst_cid", connectionID(e.DestConnectionID).String())
}

View File

@@ -162,7 +162,7 @@ func (t *connectionTracer) recordEvent(eventTime time.Time, details eventDetails
}
}
func (t *connectionTracer) StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID) {
func (t *connectionTracer) StartedConnection(local, remote net.Addr, srcConnID, destConnID protocol.ConnectionID) {
// ignore this event if we're not dealing with UDP addresses here
localAddr, ok := local.(*net.UDPAddr)
if !ok {
@@ -176,7 +176,6 @@ func (t *connectionTracer) StartedConnection(local, remote net.Addr, version pro
t.recordEvent(time.Now(), &eventConnectionStarted{
SrcAddr: localAddr,
DestAddr: remoteAddr,
Version: version,
SrcConnectionID: srcConnID,
DestConnectionID: destConnID,
})

View File

@@ -153,7 +153,6 @@ var _ = Describe("Tracing", func() {
tracer.StartedConnection(
&net.UDPAddr{IP: net.IPv4(192, 168, 13, 37), Port: 42},
&net.UDPAddr{IP: net.IPv4(192, 168, 12, 34), Port: 24},
0xdeadbeef,
protocol.ConnectionID{1, 2, 3, 4},
protocol.ConnectionID{5, 6, 7, 8},
)
@@ -166,7 +165,6 @@ var _ = Describe("Tracing", func() {
Expect(ev).To(HaveKeyWithValue("src_port", float64(42)))
Expect(ev).To(HaveKeyWithValue("dst_ip", "192.168.12.34"))
Expect(ev).To(HaveKeyWithValue("dst_port", float64(24)))
Expect(ev).To(HaveKeyWithValue("quic_version", "deadbeef"))
Expect(ev).To(HaveKeyWithValue("src_cid", "01020304"))
Expect(ev).To(HaveKeyWithValue("dst_cid", "05060708"))
})