config.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. syntax = "proto3";
  2. package v2ray.core.app.router;
  3. option csharp_namespace = "V2Ray.Core.App.Router";
  4. option go_package = "router";
  5. option java_package = "com.v2ray.core.app.router";
  6. option java_multiple_files = true;
  7. import "v2ray.com/core/common/net/port.proto";
  8. import "v2ray.com/core/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. // The list must be sorted beforehand.
  68. repeated CIDR cidr = 3 [deprecated = true];
  69. // List of GeoIPs for target IP address matching. If this entry exists, the cidr above will have no effect.
  70. // GeoIP fields with the same country code are supposed to contain exactly same content. They will be merged during runtime.
  71. // For customized GeoIPs, please leave country code empty.
  72. repeated GeoIP geoip = 10;
  73. v2ray.core.common.net.PortRange port_range = 4;
  74. // List of networks. Deprecated. Use networks.
  75. v2ray.core.common.net.NetworkList network_list = 5 [deprecated = true];
  76. // List of networks for matching.
  77. repeated v2ray.core.common.net.Network networks = 13;
  78. // List of CIDRs for source IP address matching.
  79. repeated CIDR source_cidr = 6 [deprecated = true];
  80. // List of GeoIPs for source IP address matching. If this entry exists, the source_cidr above will have no effect.
  81. repeated GeoIP source_geoip = 11;
  82. repeated string user_email = 7;
  83. repeated string inbound_tag = 8;
  84. repeated string protocol = 9;
  85. }
  86. message BalancingRule {
  87. string tag = 1;
  88. repeated string outbound_selector = 2;
  89. }
  90. message Config {
  91. enum DomainStrategy {
  92. // Use domain as is.
  93. AsIs = 0;
  94. // Always resolve IP for domains.
  95. UseIp = 1;
  96. // Resolve to IP if the domain doesn't match any rules.
  97. IpIfNonMatch = 2;
  98. // Resolve to IP if any rule requires IP matching.
  99. IpOnDemand = 3;
  100. }
  101. DomainStrategy domain_strategy = 1;
  102. repeated RoutingRule rule = 2;
  103. repeated BalancingRule balancing_rule = 3;
  104. }