config.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. syntax = "proto3";
  2. package v2ray.core.app.router;
  3. option csharp_namespace = "V2Ray.Core.App.Router";
  4. option go_package = "github.com/v2fly/v2ray-core/v4/app/router";
  5. option java_package = "com.v2ray.core.app.router";
  6. option java_multiple_files = true;
  7. import "common/net/port.proto";
  8. import "common/net/network.proto";
  9. // Domain for routing decision.
  10. message Domain {
  11. // Type of domain value.
  12. enum Type {
  13. // The value is used as is.
  14. Plain = 0;
  15. // The value is used as a regular expression.
  16. Regex = 1;
  17. // The value is a root domain.
  18. Domain = 2;
  19. // The value is a domain.
  20. Full = 3;
  21. }
  22. // Domain matching type.
  23. Type type = 1;
  24. // Domain value.
  25. string value = 2;
  26. message Attribute {
  27. string key = 1;
  28. oneof typed_value {
  29. bool bool_value = 2;
  30. int64 int_value = 3;
  31. }
  32. }
  33. // Attributes of this domain. May be used for filtering.
  34. repeated Attribute attribute = 3;
  35. }
  36. // IP for routing decision, in CIDR form.
  37. message CIDR {
  38. // IP address, should be either 4 or 16 bytes.
  39. bytes ip = 1;
  40. // Number of leading ones in the network mask.
  41. uint32 prefix = 2;
  42. }
  43. message GeoIP {
  44. string country_code = 1;
  45. repeated CIDR cidr = 2;
  46. }
  47. message GeoIPList {
  48. repeated GeoIP entry = 1;
  49. }
  50. message GeoSite {
  51. string country_code = 1;
  52. repeated Domain domain = 2;
  53. }
  54. message GeoSiteList {
  55. repeated GeoSite entry = 1;
  56. }
  57. message RoutingRule {
  58. oneof target_tag {
  59. // Tag of outbound that this rule is pointing to.
  60. string tag = 1;
  61. // Tag of routing balancer.
  62. string balancing_tag = 12;
  63. }
  64. // List of domains for target domain matching.
  65. repeated Domain domain = 2;
  66. // List of CIDRs for target IP address matching.
  67. // Deprecated. Use geoip below.
  68. repeated CIDR cidr = 3 [deprecated = true];
  69. // List of GeoIPs for target IP address matching. If this entry exists, the
  70. // cidr above will have no effect. GeoIP fields with the same country code are
  71. // supposed to contain exactly same content. They will be merged during
  72. // runtime. For customized GeoIPs, please leave country code empty.
  73. repeated GeoIP geoip = 10;
  74. // A range of port [from, to]. If the destination port is in this range, this
  75. // rule takes effect. Deprecated. Use port_list.
  76. v2ray.core.common.net.PortRange port_range = 4 [deprecated = true];
  77. // List of ports.
  78. v2ray.core.common.net.PortList port_list = 14;
  79. // List of networks. Deprecated. Use networks.
  80. v2ray.core.common.net.NetworkList network_list = 5 [deprecated = true];
  81. // List of networks for matching.
  82. repeated v2ray.core.common.net.Network networks = 13;
  83. // List of CIDRs for source IP address matching.
  84. repeated CIDR source_cidr = 6 [deprecated = true];
  85. // List of GeoIPs for source IP address matching. If this entry exists, the
  86. // source_cidr above will have no effect.
  87. repeated GeoIP source_geoip = 11;
  88. // List of ports for source port matching.
  89. v2ray.core.common.net.PortList source_port_list = 16;
  90. repeated string user_email = 7;
  91. repeated string inbound_tag = 8;
  92. repeated string protocol = 9;
  93. string attributes = 15;
  94. string domain_matcher = 17;
  95. }
  96. message BalancingRule {
  97. string tag = 1;
  98. repeated string outbound_selector = 2;
  99. }
  100. message Config {
  101. enum DomainStrategy {
  102. // Use domain as is.
  103. AsIs = 0;
  104. // Always resolve IP for domains.
  105. UseIp = 1;
  106. // Resolve to IP if the domain doesn't match any rules.
  107. IpIfNonMatch = 2;
  108. // Resolve to IP if any rule requires IP matching.
  109. IpOnDemand = 3;
  110. }
  111. DomainStrategy domain_strategy = 1;
  112. repeated RoutingRule rule = 2;
  113. repeated BalancingRule balancing_rule = 3;
  114. }