edition = "2023";

// If you make any changes make sure you run: make regenerate-proto

package gitlab.agent.agent2kas_tunnel;

option go_package = "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v18/internal/module/agent2kas_tunnel/router";
option features.field_presence = IMPLICIT;

import "buf/validate/validate.proto";

// MultiURL represents a network endpoint.
// Either host or one or more IPs must be set.
message MultiURL {
  option (buf.validate.message).cel = {
    id: "ip_or_host_set",
    message: "either ip or host must be set",
    expression: "(this.host != '' && this.ip.size() == 0) || (this.host == '' && this.ip.size() > 0)"
  };

  string scheme = 1 [(buf.validate.field).string.min_bytes = 1];
  // Zero or more IP addresses.
  repeated bytes ip = 2 [(buf.validate.field).repeated.items.bytes.ip = true];
  // DNS host.
  string host = 3;
  // Optional hostname to use for TLS certificate verification.
  string tls_host = 4;
  // Port.
  uint32 port = 5 [(buf.validate.field).uint32.lte = 0xFFFF];
}
