File: connection_tracer_multiplexer.go

package info (click to toggle)
golang-github-lucas-clemente-quic-go 0.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,312 kB
  • sloc: sh: 54; makefile: 7
file content (236 lines) | stat: -rw-r--r-- 6,357 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// Code generated by generate_multiplexer.go; DO NOT EDIT.

package logging

import (
	"net"
	"time"
)

func NewMultiplexedConnectionTracer(tracers ...*ConnectionTracer) *ConnectionTracer {
	if len(tracers) == 0 {
		return nil
	}
	if len(tracers) == 1 {
		return tracers[0]
	}
	return &ConnectionTracer{
		StartedConnection: func(local net.Addr, remote net.Addr, srcConnID ConnectionID, destConnID ConnectionID) {
			for _, t := range tracers {
				if t.StartedConnection != nil {
					t.StartedConnection(local, remote, srcConnID, destConnID)
				}
			}
		},
		NegotiatedVersion: func(chosen Version, clientVersions []Version, serverVersions []Version) {
			for _, t := range tracers {
				if t.NegotiatedVersion != nil {
					t.NegotiatedVersion(chosen, clientVersions, serverVersions)
				}
			}
		},
		ClosedConnection: func(err error) {
			for _, t := range tracers {
				if t.ClosedConnection != nil {
					t.ClosedConnection(err)
				}
			}
		},
		SentTransportParameters: func(parameters *TransportParameters) {
			for _, t := range tracers {
				if t.SentTransportParameters != nil {
					t.SentTransportParameters(parameters)
				}
			}
		},
		ReceivedTransportParameters: func(parameters *TransportParameters) {
			for _, t := range tracers {
				if t.ReceivedTransportParameters != nil {
					t.ReceivedTransportParameters(parameters)
				}
			}
		},
		RestoredTransportParameters: func(parameters *TransportParameters) {
			for _, t := range tracers {
				if t.RestoredTransportParameters != nil {
					t.RestoredTransportParameters(parameters)
				}
			}
		},
		SentLongHeaderPacket: func(hdr *ExtendedHeader, size ByteCount, ecn ECN, ack *AckFrame, frames []Frame) {
			for _, t := range tracers {
				if t.SentLongHeaderPacket != nil {
					t.SentLongHeaderPacket(hdr, size, ecn, ack, frames)
				}
			}
		},
		SentShortHeaderPacket: func(hdr *ShortHeader, size ByteCount, ecn ECN, ack *AckFrame, frames []Frame) {
			for _, t := range tracers {
				if t.SentShortHeaderPacket != nil {
					t.SentShortHeaderPacket(hdr, size, ecn, ack, frames)
				}
			}
		},
		ReceivedVersionNegotiationPacket: func(dest ArbitraryLenConnectionID, src ArbitraryLenConnectionID, versions []Version) {
			for _, t := range tracers {
				if t.ReceivedVersionNegotiationPacket != nil {
					t.ReceivedVersionNegotiationPacket(dest, src, versions)
				}
			}
		},
		ReceivedRetry: func(hdr *Header) {
			for _, t := range tracers {
				if t.ReceivedRetry != nil {
					t.ReceivedRetry(hdr)
				}
			}
		},
		ReceivedLongHeaderPacket: func(hdr *ExtendedHeader, size ByteCount, ecn ECN, frames []Frame) {
			for _, t := range tracers {
				if t.ReceivedLongHeaderPacket != nil {
					t.ReceivedLongHeaderPacket(hdr, size, ecn, frames)
				}
			}
		},
		ReceivedShortHeaderPacket: func(hdr *ShortHeader, size ByteCount, ecn ECN, frames []Frame) {
			for _, t := range tracers {
				if t.ReceivedShortHeaderPacket != nil {
					t.ReceivedShortHeaderPacket(hdr, size, ecn, frames)
				}
			}
		},
		BufferedPacket: func(packetType PacketType, size ByteCount) {
			for _, t := range tracers {
				if t.BufferedPacket != nil {
					t.BufferedPacket(packetType, size)
				}
			}
		},
		DroppedPacket: func(packetType PacketType, pn PacketNumber, size ByteCount, reason PacketDropReason) {
			for _, t := range tracers {
				if t.DroppedPacket != nil {
					t.DroppedPacket(packetType, pn, size, reason)
				}
			}
		},
		UpdatedMetrics: func(rttStats *RTTStats, cwnd ByteCount, bytesInFlight ByteCount, packetsInFlight int) {
			for _, t := range tracers {
				if t.UpdatedMetrics != nil {
					t.UpdatedMetrics(rttStats, cwnd, bytesInFlight, packetsInFlight)
				}
			}
		},
		AcknowledgedPacket: func(encLevel EncryptionLevel, pn PacketNumber) {
			for _, t := range tracers {
				if t.AcknowledgedPacket != nil {
					t.AcknowledgedPacket(encLevel, pn)
				}
			}
		},
		LostPacket: func(encLevel EncryptionLevel, pn PacketNumber, reason PacketLossReason) {
			for _, t := range tracers {
				if t.LostPacket != nil {
					t.LostPacket(encLevel, pn, reason)
				}
			}
		},
		UpdatedMTU: func(mtu ByteCount, done bool) {
			for _, t := range tracers {
				if t.UpdatedMTU != nil {
					t.UpdatedMTU(mtu, done)
				}
			}
		},
		UpdatedCongestionState: func(state CongestionState) {
			for _, t := range tracers {
				if t.UpdatedCongestionState != nil {
					t.UpdatedCongestionState(state)
				}
			}
		},
		UpdatedPTOCount: func(value uint32) {
			for _, t := range tracers {
				if t.UpdatedPTOCount != nil {
					t.UpdatedPTOCount(value)
				}
			}
		},
		UpdatedKeyFromTLS: func(encLevel EncryptionLevel, p Perspective) {
			for _, t := range tracers {
				if t.UpdatedKeyFromTLS != nil {
					t.UpdatedKeyFromTLS(encLevel, p)
				}
			}
		},
		UpdatedKey: func(keyPhase KeyPhase, remote bool) {
			for _, t := range tracers {
				if t.UpdatedKey != nil {
					t.UpdatedKey(keyPhase, remote)
				}
			}
		},
		DroppedEncryptionLevel: func(encLevel EncryptionLevel) {
			for _, t := range tracers {
				if t.DroppedEncryptionLevel != nil {
					t.DroppedEncryptionLevel(encLevel)
				}
			}
		},
		DroppedKey: func(keyPhase KeyPhase) {
			for _, t := range tracers {
				if t.DroppedKey != nil {
					t.DroppedKey(keyPhase)
				}
			}
		},
		SetLossTimer: func(timerType TimerType, encLevel EncryptionLevel, time time.Time) {
			for _, t := range tracers {
				if t.SetLossTimer != nil {
					t.SetLossTimer(timerType, encLevel, time)
				}
			}
		},
		LossTimerExpired: func(timerType TimerType, encLevel EncryptionLevel) {
			for _, t := range tracers {
				if t.LossTimerExpired != nil {
					t.LossTimerExpired(timerType, encLevel)
				}
			}
		},
		LossTimerCanceled: func() {
			for _, t := range tracers {
				if t.LossTimerCanceled != nil {
					t.LossTimerCanceled()
				}
			}
		},
		ECNStateUpdated: func(state ECNState, trigger ECNStateTrigger) {
			for _, t := range tracers {
				if t.ECNStateUpdated != nil {
					t.ECNStateUpdated(state, trigger)
				}
			}
		},
		ChoseALPN: func(protocol string) {
			for _, t := range tracers {
				if t.ChoseALPN != nil {
					t.ChoseALPN(protocol)
				}
			}
		},
		Close: func() {
			for _, t := range tracers {
				if t.Close != nil {
					t.Close()
				}
			}
		},
		Debug: func(name string, msg string) {
			for _, t := range tracers {
				if t.Debug != nil {
					t.Debug(name, msg)
				}
			}
		},
	}
}