github.com/xmplusdev/xmcore@v1.8.11-0.20240412132628-5518b55526af/app/router/config.proto (about)

     1  syntax = "proto3";
     2  
     3  package xray.app.router;
     4  option csharp_namespace = "Xray.App.Router";
     5  option go_package = "github.com/xmplusdev/xmcore/app/router";
     6  option java_package = "com.xray.app.router";
     7  option java_multiple_files = true;
     8  
     9  import "common/serial/typed_message.proto";
    10  import "common/net/port.proto";
    11  import "common/net/network.proto";
    12  
    13  // Domain for routing decision.
    14  message Domain {
    15    // Type of domain value.
    16    enum Type {
    17      // The value is used as is.
    18      Plain = 0;
    19      // The value is used as a regular expression.
    20      Regex = 1;
    21      // The value is a root domain.
    22      Domain = 2;
    23      // The value is a domain.
    24      Full = 3;
    25    }
    26  
    27    // Domain matching type.
    28    Type type = 1;
    29  
    30    // Domain value.
    31    string value = 2;
    32  
    33    message Attribute {
    34      string key = 1;
    35  
    36      oneof typed_value {
    37        bool bool_value = 2;
    38        int64 int_value = 3;
    39      }
    40    }
    41  
    42    // Attributes of this domain. May be used for filtering.
    43    repeated Attribute attribute = 3;
    44  }
    45  
    46  // IP for routing decision, in CIDR form.
    47  message CIDR {
    48    // IP address, should be either 4 or 16 bytes.
    49    bytes ip = 1;
    50  
    51    // Number of leading ones in the network mask.
    52    uint32 prefix = 2;
    53  }
    54  
    55  message GeoIP {
    56    string country_code = 1;
    57    repeated CIDR cidr = 2;
    58    bool reverse_match = 3;
    59  }
    60  
    61  message GeoIPList {
    62    repeated GeoIP entry = 1;
    63  }
    64  
    65  message GeoSite {
    66    string country_code = 1;
    67    repeated Domain domain = 2;
    68  }
    69  
    70  message GeoSiteList {
    71    repeated GeoSite entry = 1;
    72  }
    73  
    74  message RoutingRule {
    75    oneof target_tag {
    76      // Tag of outbound that this rule is pointing to.
    77      string tag = 1;
    78  
    79      // Tag of routing balancer.
    80      string balancing_tag = 12;
    81    }
    82      string rule_tag = 18;
    83  
    84    // List of domains for target domain matching.
    85    repeated Domain domain = 2;
    86  
    87    // List of CIDRs for target IP address matching.
    88    // Deprecated. Use geoip below.
    89    repeated CIDR cidr = 3 [deprecated = true];
    90  
    91    // List of GeoIPs for target IP address matching. If this entry exists, the
    92    // cidr above will have no effect. GeoIP fields with the same country code are
    93    // supposed to contain exactly same content. They will be merged during
    94    // runtime. For customized GeoIPs, please leave country code empty.
    95    repeated GeoIP geoip = 10;
    96  
    97    // A range of port [from, to]. If the destination port is in this range, this
    98    // rule takes effect. Deprecated. Use port_list.
    99    xray.common.net.PortRange port_range = 4 [deprecated = true];
   100  
   101    // List of ports.
   102    xray.common.net.PortList port_list = 14;
   103  
   104    // List of networks. Deprecated. Use networks.
   105    xray.common.net.NetworkList network_list = 5 [deprecated = true];
   106  
   107    // List of networks for matching.
   108    repeated xray.common.net.Network networks = 13;
   109  
   110    // List of CIDRs for source IP address matching.
   111    repeated CIDR source_cidr = 6 [deprecated = true];
   112  
   113    // List of GeoIPs for source IP address matching. If this entry exists, the
   114    // source_cidr above will have no effect.
   115    repeated GeoIP source_geoip = 11;
   116  
   117    // List of ports for source port matching.
   118    xray.common.net.PortList source_port_list = 16;
   119  
   120    repeated string user_email = 7;
   121    repeated string inbound_tag = 8;
   122    repeated string protocol = 9;
   123  
   124    map<string, string> attributes = 15;
   125  
   126    string domain_matcher = 17;
   127  }
   128  
   129  message BalancingRule {
   130    string tag = 1;
   131    repeated string outbound_selector = 2;
   132    string strategy = 3;
   133    xray.common.serial.TypedMessage strategy_settings = 4;
   134    string fallback_tag = 5;
   135  }
   136  
   137  message StrategyWeight {
   138    bool regexp = 1;
   139    string match = 2;
   140    float value =3;
   141  }
   142  
   143  message StrategyLeastLoadConfig {
   144    // weight settings
   145    repeated StrategyWeight costs = 2;
   146    // RTT baselines for selecting, int64 values of time.Duration
   147    repeated int64 baselines = 3;
   148    // expected nodes count to select
   149    int32 expected = 4;
   150    // max acceptable rtt, filter away high delay nodes. defalut 0
   151    int64 maxRTT = 5;
   152    // acceptable failure rate
   153    float tolerance = 6;
   154  }
   155  
   156  message Config {
   157    enum DomainStrategy {
   158      // Use domain as is.
   159      AsIs = 0;
   160  
   161      // Always resolve IP for domains.
   162      UseIp = 1;
   163  
   164      // Resolve to IP if the domain doesn't match any rules.
   165      IpIfNonMatch = 2;
   166  
   167      // Resolve to IP if any rule requires IP matching.
   168      IpOnDemand = 3;
   169    }
   170    DomainStrategy domain_strategy = 1;
   171    repeated RoutingRule rule = 2;
   172    repeated BalancingRule balancing_rule = 3;
   173  }