syntax = "proto3";

package envoy.extensions.bootstrap.reverse_tunnel.upstream_socket_interface.v3;

import "envoy/config/accesslog/v3/accesslog.proto";
import "envoy/config/core/v3/extension.proto";

import "google/protobuf/wrappers.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.bootstrap.reverse_tunnel.upstream_socket_interface.v3";
option java_outer_classname = "UpstreamReverseConnectionSocketInterfaceProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/bootstrap/reverse_tunnel/upstream_socket_interface/v3;upstream_socket_interfacev3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Upstream reverse connection socket interface]
// [#extension: envoy.bootstrap.reverse_tunnel.upstream_socket_interface]

// Configuration for the upstream reverse connection socket interface.
// [#next-free-field: 7]
message UpstreamReverseConnectionSocketInterface {
  // Stat prefix for upstream reverse connection socket interface stats.
  string stat_prefix = 1;

  // Number of consecutive ping failures before an idle reverse connection socket is marked dead.
  // Defaults to 3 if unset. Must be at least 1.
  google.protobuf.UInt32Value ping_failure_threshold = 2 [(validate.rules).uint32 = {gte: 1}];

  // Enable detailed per-node and per-cluster statistics.
  // When enabled, emits hidden statistics for individual nodes and clusters.
  // Defaults to false.
  bool enable_detailed_stats = 3;

  // Optional configuration for a tunnel reporting extension. When provided,
  // the socket interface instantiates a reporter via the configured factory.
  // If unset, no reporting is done.
  config.core.v3.TypedExtensionConfig reporter_config = 4;

  // Enables tenant-aware isolation for reverse connections. When set to ``true``, the socket
  // interface requires tenant identifiers in addition to node and cluster identifiers and derives
  // composite ``tenant:node`` and ``tenant:cluster`` keys for socket tracking. Identifiers
  // containing the ``:`` delimiter are rejected to avoid ambiguity.
  // Defaults to ``false`` for backwards compatibility.
  google.protobuf.BoolValue enable_tenant_isolation = 5;

  // Access logs emitted for reverse tunnel lifecycle events. Entries are generated for tunnel setup,
  // socket handoff, tunnel close, and post-handoff HTTP/2 keepalive timeout observations.
  repeated config.accesslog.v3.AccessLog access_log = 6;
}
