config.proto 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. }
  27. // IP for routing decision, in CIDR form.
  28. message CIDR {
  29. // IP address, should be either 4 or 16 bytes.
  30. bytes ip = 1;
  31. // Number of leading ones in the network mask.
  32. uint32 prefix = 2;
  33. }
  34. message GeoIP {
  35. string country_code = 1;
  36. repeated CIDR cidr = 2;
  37. }
  38. message GeoIPList {
  39. repeated GeoIP entry = 1;
  40. }
  41. message GeoSite {
  42. string country_code = 1;
  43. repeated Domain domain = 2;
  44. }
  45. message GeoSiteList{
  46. repeated GeoSite entry = 1;
  47. }
  48. message RoutingRule {
  49. oneof target_tag {
  50. // Tag of outbound that this rule is pointing to.
  51. string tag = 1;
  52. // Tag of routing balancer.
  53. string balancing_tag = 12;
  54. }
  55. // List of domains for target domain matching.
  56. repeated Domain domain = 2;
  57. // List of CIDRs for target IP address matching.
  58. // The list must be sorted beforehand.
  59. repeated CIDR cidr = 3 [deprecated = true];
  60. // List of GeoIPs for target IP address matching. If this entry exists, the cidr above will have no effect.
  61. // GeoIP fields with the same country code are supposed to contain exactly same content. They will be merged during runtime.
  62. // For customized GeoIPs, please leave country code empty.
  63. repeated GeoIP geoip = 10;
  64. v2ray.core.common.net.PortRange port_range = 4;
  65. // List of networks. Deprecated. Use networks.
  66. v2ray.core.common.net.NetworkList network_list = 5 [deprecated = true];
  67. // List of networks for matching.
  68. repeated v2ray.core.common.net.Network networks = 13;
  69. // List of CIDRs for source IP address matching.
  70. repeated CIDR source_cidr = 6 [deprecated = true];
  71. // List of GeoIPs for source IP address matching. If this entry exists, the source_cidr above will have no effect.
  72. repeated GeoIP source_geoip = 11;
  73. repeated string user_email = 7;
  74. repeated string inbound_tag = 8;
  75. repeated string protocol = 9;
  76. }
  77. message BalancingRule {
  78. string tag = 1;
  79. repeated string outbound_selector = 2;
  80. }
  81. message Config {
  82. enum DomainStrategy {
  83. // Use domain as is.
  84. AsIs = 0;
  85. // Always resolve IP for domains.
  86. UseIp = 1;
  87. // Resolve to IP if the domain doesn't match any rules.
  88. IpIfNonMatch = 2;
  89. // Resolve to IP if any rule requires IP matching.
  90. IpOnDemand = 3;
  91. }
  92. DomainStrategy domain_strategy = 1;
  93. repeated RoutingRule rule = 2;
  94. repeated BalancingRule balancing_rule = 3;
  95. }