// 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.quic.server_preferred_address.v3;

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

import "udpa/annotations/status.proto";

option java_package = "io.envoyproxy.envoy.extensions.quic.server_preferred_address.v3";
option java_outer_classname = "FixedServerPreferredAddressConfigProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/quic/server_preferred_address/v3;server_preferred_addressv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: QUIC fixed server preferred address config]
// [#extension: envoy.quic.server_preferred_address.fixed]

// Configuration for FixedServerPreferredAddressConfig.
message FixedServerPreferredAddressConfig {
  // Addresses for server preferred address for a single address family (IPv4 or IPv6).
  message AddressFamilyConfig {
    // The server preferred address sent to clients.
    //
    // .. note::
    //
    //   Envoy currently requires all packets for a QUIC connection to arrive on the same port. Therefore, unless a
    //   :ref:`dnat_address <envoy_v3_api_field_extensions.quic.server_preferred_address.v3.FixedServerPreferredAddressConfig.AddressFamilyConfig.dnat_address>`
    //   is explicitly configured, the port specified here must be set to zero. In such cases, Envoy will automatically
    //   use the listener's port.
    //
    config.core.v3.SocketAddress address = 1;

    // If a DNAT exists between the client and Envoy, this is the address where Envoy will observe incoming server
    // preferred address packets. If unspecified, Envoy assumes there is no DNAT, and packets will be sent directly
    // to the address advertised to clients as the server preferred address.
    //
    // .. note::
    //
    //   Envoy currently requires all packets for a QUIC connection to arrive on the same port. Consequently, the
    //   port for this address must be set to zero, with Envoy defaulting to the listener's port instead.
    //
    config.core.v3.SocketAddress dnat_address = 2;
  }

  // String representation of IPv4 address, i.e. "127.0.0.2".
  // If not specified, none will be configured.
  string ipv4_address = 1;

  // The IPv4 address to advertise to clients for Server Preferred Address.
  // This field takes precedence over
  // :ref:`ipv4_address <envoy_v3_api_field_extensions.quic.server_preferred_address.v3.FixedServerPreferredAddressConfig.ipv4_address>`.
  AddressFamilyConfig ipv4_config = 3;

  // String representation of IPv6 address, i.e. "::1".
  // If not specified, none will be configured.
  string ipv6_address = 2;

  // The IPv6 address to advertise to clients for Server Preferred Address.
  // This field takes precedence over
  // :ref:`ipv6_address <envoy_v3_api_field_extensions.quic.server_preferred_address.v3.FixedServerPreferredAddressConfig.ipv6_address>`.
  AddressFamilyConfig ipv6_config = 4;
}
