syntax = "proto3";

package xray.transport.internet;
option csharp_namespace = "Xray.Transport.Internet";
option go_package = "github.com/xtls/xray-core/transport/internet";
option java_package = "com.xray.transport.internet";
option java_multiple_files = true;

import "common/serial/typed_message.proto";
import "common/net/address.proto";

enum DomainStrategy {
  AS_IS = 0;
  USE_IP = 1;
  USE_IP4 = 2;
  USE_IP6 = 3;
  USE_IP46 = 4;
  USE_IP64 = 5;
  FORCE_IP = 6;
  FORCE_IP4 = 7;
  FORCE_IP6 = 8;
  FORCE_IP46 = 9;
  FORCE_IP64 = 10;
}

enum AddressPortStrategy {
  None = 0;
  SrvPortOnly = 1;
  SrvAddressOnly = 2;
  SrvPortAndAddress = 3;
  TxtPortOnly = 4;
  TxtAddressOnly = 5;
  TxtPortAndAddress = 6;
}

message TransportConfig {
  string protocol_name = 3;
  xray.common.serial.TypedMessage settings = 2;
}

message StreamConfig {
  xray.common.net.IPOrDomain address = 8;
  uint32 port = 9;
  string protocol_name = 5;
  repeated TransportConfig transport_settings = 2;
  string security_type = 3;
  repeated xray.common.serial.TypedMessage security_settings = 4;
  repeated xray.common.serial.TypedMessage udpmasks = 10;
  repeated xray.common.serial.TypedMessage tcpmasks = 11;
  QuicParams quic_params = 12;
  SocketConfig socket_settings = 6;
}

message QuicParams {
  string congestion = 1;
  uint64 up = 2;
}

message ProxyConfig {
  string tag = 1;
  bool transportLayerProxy = 2;
}

message CustomSockopt {
  string system = 1;
  string network = 2;
  string level = 3;
  string opt = 4;
  string value = 5;
  string type = 6;
}

message SocketConfig {
  int32 mark = 1;
  int32 tfo = 2;

  enum TProxyMode {
    Off = 0;
    TProxy = 1;
    Redirect = 2;
  }

  TProxyMode tproxy = 3;
  bool receive_original_dest_address = 4;
  bytes bind_address = 5;
  uint32 bind_port = 6;
  bool accept_proxy_protocol = 7;
  DomainStrategy domain_strategy = 8;
  string dialer_proxy = 9;
  int32 tcp_keep_alive_interval = 10;
  int32 tcp_keep_alive_idle = 11;
  string tcp_congestion = 12;
  string interface = 13;
  bool v6only = 14;
  int32 tcp_window_clamp = 15;
  int32 tcp_user_timeout = 16;
  int32 tcp_max_seg = 17;
  bool penetrate = 18;
  bool tcp_mptcp = 19;
  repeated CustomSockopt customSockopt = 20;
  AddressPortStrategy address_port_strategy = 21;
  HappyEyeballsConfig happy_eyeballs = 22;
  repeated string trusted_x_forwarded_for = 23;
}

message HappyEyeballsConfig {
  bool prioritize_ipv6 = 1;
  uint32 interleave = 2;
  uint64 try_delayMs = 3;
  uint32 max_concurrent_try = 4;
}
