From 0f1bfe99ce69f05fcc9663a6d4cde683bbce34f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20=22Pisco=22=20Fernandes?= Date: Wed, 22 Jan 2025 07:23:46 -0800 Subject: [PATCH] TUN-8904: Rename Connect Response Flow Rate Limited metadata ## Summary This commit renames the public variable that identifies the metadata key and value for the ConnectResponse structure when the flow was rate limited. Closes TUN-8904 --- connection/quic_connection.go | 2 +- connection/quic_connection_test.go | 2 +- tunnelrpc/pogs/quic_metadata_protocol.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/connection/quic_connection.go b/connection/quic_connection.go index 59308db0..87e73ae2 100644 --- a/connection/quic_connection.go +++ b/connection/quic_connection.go @@ -186,7 +186,7 @@ func (q *quicConnection) handleDataStream(ctx context.Context, stream *rpcquic.R var metadata []pogs.Metadata // Check the type of error that was throw and add metadata that will help identify it on OTD. if errors.Is(err, cfdflow.ErrTooManyActiveFlows) { - metadata = append(metadata, pogs.ErrorFlowConnectRateLimitedKey) + metadata = append(metadata, pogs.ErrorFlowConnectRateLimitedMetadata) } if writeRespErr := stream.WriteConnectResponseData(err, metadata...); writeRespErr != nil { diff --git a/connection/quic_connection_test.go b/connection/quic_connection_test.go index e8ff6d55..49968372 100644 --- a/connection/quic_connection_test.go +++ b/connection/quic_connection_test.go @@ -639,7 +639,7 @@ func TestTCPProxy_FlowRateLimited(t *testing.T) { // Got Rate Limited assert.NotEmpty(t, response.Error) - assert.Contains(t, response.Metadata, pogs.ErrorFlowConnectRateLimitedKey) + assert.Contains(t, response.Metadata, pogs.ErrorFlowConnectRateLimitedMetadata) }() tunnelConn, _ := testTunnelConnection(t, netip.MustParseAddrPort(udpListener.LocalAddr().String()), uint8(0)) diff --git a/tunnelrpc/pogs/quic_metadata_protocol.go b/tunnelrpc/pogs/quic_metadata_protocol.go index d73c9732..57333b54 100644 --- a/tunnelrpc/pogs/quic_metadata_protocol.go +++ b/tunnelrpc/pogs/quic_metadata_protocol.go @@ -19,8 +19,8 @@ const ( ) var ( - // ErrorFlowConnectRateLimitedKey is the Metadata entry that allows to know if a request was rate limited on connect. - ErrorFlowConnectRateLimitedKey = Metadata{Key: "FlowConnectRateLimited", Val: "true"} + // ErrorFlowConnectRateLimitedMetadata is the Metadata entry that allows to know if a request was rate limited on connect. + ErrorFlowConnectRateLimitedMetadata = Metadata{Key: "FlowConnectRateLimited", Val: "true"} ) func (c ConnectionType) String() string {