config.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. // Tag of outbound that this rule is pointing to.
  50. string tag = 1;
  51. // List of domains for target domain matching.
  52. repeated Domain domain = 2;
  53. // List of CIDRs for target IP address matching.
  54. // The list must be sorted beforehand.
  55. repeated CIDR cidr = 3 [deprecated = true];
  56. // List of GeoIPs for target IP address matching. If this entry exists, the cidr above will have no effect.
  57. // GeoIP fields with the same country code are supposed to contain exactly same content. They will be merged during runtime.
  58. // For customized GeoIPs, please leave country code empty.
  59. // The CIDR list in the GeoIP must be sorted beforehand.
  60. repeated GeoIP geoip = 10;
  61. v2ray.core.common.net.PortRange port_range = 4;
  62. v2ray.core.common.net.NetworkList network_list = 5;
  63. // List of CIDRs for source IP address matching.
  64. // The list must be sorted beforehand.
  65. repeated CIDR source_cidr = 6 [deprecated = true];
  66. // List of GeoIPs for source IP address matching. If this entry exists, the source_cidr above will have no effect.
  67. // The CIDR list in the GeoIP must be sorted beforehand.
  68. repeated GeoIP source_geoip = 11;
  69. repeated string user_email = 7;
  70. repeated string inbound_tag = 8;
  71. repeated string protocol = 9;
  72. }
  73. message Config {
  74. enum DomainStrategy {
  75. // Use domain as is.
  76. AsIs = 0;
  77. // Always resolve IP for domains.
  78. UseIp = 1;
  79. // Resolve to IP if the domain doesn't match any rules.
  80. IpIfNonMatch = 2;
  81. // Resolve to IP if any rule requires IP matching.
  82. IpOnDemand = 3;
  83. }
  84. DomainStrategy domain_strategy = 1;
  85. repeated RoutingRule rule = 2;
  86. }