// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.extensions.upstreams.tcp.v3;

import "google/protobuf/duration.proto";

import "udpa/annotations/status.proto";

option java_package = "io.envoyproxy.envoy.extensions.upstreams.tcp.v3";
option java_outer_classname = "TcpProtocolOptionsProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/upstreams/tcp/v3;tcpv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: TCP Protocol Options]
// [#extension: envoy.upstreams.tcp.tcp_protocol_options]

// TCProtocolOptions specifies TCP upstream protocol options. This object
// is used in
// :ref:`typed_extension_protocol_options<envoy_v3_api_field_config.cluster.v3.Cluster.typed_extension_protocol_options>`,
// keyed by the name ``envoy.extensions.upstreams.tcp.v3.TcpProtocolOptions``.
//
// .. code::
//
//   clusters:
//     - name: some_service
//       connect_timeout: 5s
//       typed_extension_protocol_options:
//         envoy.extensions.upstreams.tcp.v3.TcpProtocolOptions:
//           "@type": type.googleapis.com/envoy.extensions.upstreams.tcp.v3.TcpProtocolOptions
//           idle_timeout: 10m
//        .... [further cluster config]

message TcpProtocolOptions {
  // The idle timeout for the connection. The idle timeout is defined as the period in which
  // the connection is not associated with a downstream connection. When the idle timeout is
  // reached, the connection will be closed.
  //
  // If not set, the default idle timeout is 10 minutes. To disable idle timeouts, explicitly set this to 0.
  //
  // .. warning::
  //   Disabling this timeout has a highly likelihood of yielding connection leaks due to lost TCP
  //   FIN packets, etc.
  google.protobuf.Duration idle_timeout = 1;
}
