syntax = "proto3";

package envoy.extensions.filters.network.tcp_bandwidth_limit.v3;

import "envoy/config/core/v3/base.proto";

import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";

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

option java_package = "io.envoyproxy.envoy.extensions.filters.network.tcp_bandwidth_limit.v3";
option java_outer_classname = "TcpBandwidthLimitProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/tcp_bandwidth_limit/v3;tcp_bandwidth_limitv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: TCP Bandwidth Limit]
// TCP Bandwidth Limit :ref:`configuration overview <config_network_filters_tcp_bandwidth_limit>`.
// [#extension: envoy.filters.network.tcp_bandwidth_limit]

// [#next-free-field: 6]
message TcpBandwidthLimit {
  // The human readable prefix to use when emitting stats.
  string stat_prefix = 1 [(validate.rules).string = {min_len: 1}];

  // The limit for read (onData) bandwidth in KiB/s.
  // If not set, no limit is applied (unlimited bandwidth).
  // If set to 0, all reads are blocked.
  google.protobuf.UInt64Value read_limit_kbps = 2;

  // The limit for write (onWrite) bandwidth in KiB/s.
  // If not set, no limit is applied (unlimited bandwidth).
  // If set to 0, all writes are is blocked.
  google.protobuf.UInt64Value write_limit_kbps = 3;

  // The interval at which to process buffered data and check for available bandwidth.
  // Defaults to 50ms. It must be at least 20ms to avoid too frequent processing.
  google.protobuf.Duration fill_interval = 4 [(validate.rules).duration = {
    lte {seconds: 1}
    gte {nanos: 20000000}
  }];

  // Runtime flag that controls whether the filter is enabled or not. If not specified, defaults
  // to enabled.
  config.core.v3.RuntimeFeatureFlag runtime_enabled = 5;
}
