config.proto 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 "google/protobuf/any.proto";
  8. import "common/net/port.proto";
  9. import "common/net/network.proto";
  10. import "common/protoext/extensions.proto";
  11. import "app/router/routercommon/common.proto";
  12. message RoutingRule {
  13. oneof target_tag {
  14. // Tag of outbound that this rule is pointing to.
  15. string tag = 1;
  16. // Tag of routing balancer.
  17. string balancing_tag = 12;
  18. }
  19. // List of domains for target domain matching.
  20. repeated v2ray.core.app.router.routercommon.Domain domain = 2;
  21. // List of CIDRs for target IP address matching.
  22. // Deprecated. Use geoip below.
  23. repeated v2ray.core.app.router.routercommon.CIDR cidr = 3 [deprecated = true];
  24. // List of GeoIPs for target IP address matching. If this entry exists, the
  25. // cidr above will have no effect. GeoIP fields with the same country code are
  26. // supposed to contain exactly same content. They will be merged during
  27. // runtime. For customized GeoIPs, please leave country code empty.
  28. repeated v2ray.core.app.router.routercommon.GeoIP geoip = 10;
  29. // A range of port [from, to]. If the destination port is in this range, this
  30. // rule takes effect. Deprecated. Use port_list.
  31. v2ray.core.common.net.PortRange port_range = 4 [deprecated = true];
  32. // List of ports.
  33. v2ray.core.common.net.PortList port_list = 14;
  34. // List of networks. Deprecated. Use networks.
  35. v2ray.core.common.net.NetworkList network_list = 5 [deprecated = true];
  36. // List of networks for matching.
  37. repeated v2ray.core.common.net.Network networks = 13;
  38. // List of CIDRs for source IP address matching.
  39. repeated v2ray.core.app.router.routercommon.CIDR source_cidr = 6 [deprecated = true];
  40. // List of GeoIPs for source IP address matching. If this entry exists, the
  41. // source_cidr above will have no effect.
  42. repeated v2ray.core.app.router.routercommon.GeoIP source_geoip = 11;
  43. // List of ports for source port matching.
  44. v2ray.core.common.net.PortList source_port_list = 16;
  45. repeated string user_email = 7;
  46. repeated string inbound_tag = 8;
  47. repeated string protocol = 9;
  48. string attributes = 15;
  49. string domain_matcher = 17;
  50. // geo_domain instruct simplified config loader to load geo domain rule and fill in domain field.
  51. repeated v2ray.core.app.router.routercommon.GeoSite geo_domain = 68001;
  52. }
  53. message BalancingRule {
  54. string tag = 1;
  55. repeated string outbound_selector = 2;
  56. string strategy = 3;
  57. google.protobuf.Any strategy_settings = 4;
  58. string fallback_tag = 5;
  59. }
  60. message StrategyWeight {
  61. bool regexp = 1;
  62. string match = 2;
  63. float value = 3;
  64. }
  65. message StrategyLeastPingConfig {
  66. string observer_tag = 7;
  67. }
  68. message StrategyLeastLoadConfig {
  69. // weight settings
  70. repeated StrategyWeight costs = 2;
  71. // RTT baselines for selecting, int64 values of time.Duration
  72. repeated int64 baselines = 3;
  73. // expected nodes count to select
  74. int32 expected = 4;
  75. // max acceptable rtt, filter away high delay nodes. defalut 0
  76. int64 maxRTT = 5;
  77. // acceptable failure rate
  78. float tolerance = 6;
  79. string observer_tag = 7;
  80. }
  81. enum DomainStrategy {
  82. // Use domain as is.
  83. AsIs = 0;
  84. // Always resolve IP for domains.
  85. UseIp = 1;
  86. // Resolve to IP if the domain doesn't match any rules.
  87. IpIfNonMatch = 2;
  88. // Resolve to IP if any rule requires IP matching.
  89. IpOnDemand = 3;
  90. }
  91. message Config {
  92. DomainStrategy domain_strategy = 1;
  93. repeated RoutingRule rule = 2;
  94. repeated BalancingRule balancing_rule = 3;
  95. }
  96. message SimplifiedConfig {
  97. option (v2ray.core.common.protoext.message_opt).type = "service";
  98. option (v2ray.core.common.protoext.message_opt).short_name = "router";
  99. DomainStrategy domain_strategy = 1;
  100. repeated RoutingRule rule = 2;
  101. repeated BalancingRule balancing_rule = 3;
  102. }