config.proto 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. syntax = "proto3";
  2. package v2ray.core.app.router;
  3. option go_package = "router";
  4. option java_package = "com.v2ray.core.app.router";
  5. option java_outer_classname = "ConfigProto";
  6. import "v2ray.com/core/common/net/port.proto";
  7. import "v2ray.com/core/common/net/network.proto";
  8. // Domain for routing decision.
  9. message Domain {
  10. // Type of domain value.
  11. enum Type {
  12. // The value is used as is.
  13. Plain = 0;
  14. // The value is used as a regular expression.
  15. Regex = 1;
  16. }
  17. // Domain matching type.
  18. Type type = 1;
  19. // Domain value.
  20. string value = 2;
  21. }
  22. // IP for routing decision.
  23. message IP {
  24. // IP address, should be either 4 or 16 bytes.
  25. bytes ip = 1;
  26. // Number of right-most bits in IP matching that is allowed.
  27. // Single IP address like 127.0.0.1 should use unmatching_bits = 0.
  28. // CIDR 10.0.0.0/8 should use unmatching_bits = 32-8 = 24.
  29. uint32 unmatching_bits = 2;
  30. }
  31. message RoutingRule {
  32. string tag = 1;
  33. repeated Domain domain = 2;
  34. repeated IP ip = 3;
  35. v2ray.core.common.net.PortRange port_range = 4;
  36. v2ray.core.common.net.NetworkList network_list = 5;
  37. }
  38. message Config {
  39. enum DomainStrategy {
  40. // Use domain as is.
  41. AsIs = 0;
  42. // Always resolve IP for domains.
  43. UseIp = 1;
  44. // Resolve to IP if the domain doesn't match any rules.
  45. IpIfNonMatch = 2;
  46. }
  47. DomainStrategy domain_strategy = 1;
  48. repeated RoutingRule rule = 2;
  49. }