command.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. syntax = "proto3";
  2. package xray.app.router.command;
  3. option csharp_namespace = "Xray.App.Router.Command";
  4. option go_package = "github.com/xtls/xray-core/app/router/command";
  5. option java_package = "com.xray.app.router.command";
  6. option java_multiple_files = true;
  7. import "common/net/network.proto";
  8. import "common/serial/typed_message.proto";
  9. // RoutingContext is the context with information relative to routing process.
  10. // It conforms to the structure of xray.features.routing.Context and
  11. // xray.features.routing.Route.
  12. message RoutingContext {
  13. string InboundTag = 1;
  14. xray.common.net.Network Network = 2;
  15. repeated bytes SourceIPs = 3;
  16. repeated bytes TargetIPs = 4;
  17. uint32 SourcePort = 5;
  18. uint32 TargetPort = 6;
  19. string TargetDomain = 7;
  20. string Protocol = 8;
  21. string User = 9;
  22. map<string, string> Attributes = 10;
  23. repeated string OutboundGroupTags = 11;
  24. string OutboundTag = 12;
  25. repeated bytes LocalIPs = 13;
  26. uint32 LocalPort = 14;
  27. uint32 VlessRoute = 15;
  28. }
  29. // SubscribeRoutingStatsRequest subscribes to routing statistics channel if
  30. // opened by xray-core.
  31. // * FieldSelectors selects a subset of fields in routing statistics to return.
  32. // Valid selectors:
  33. // - inbound: Selects connection's inbound tag.
  34. // - network: Selects connection's network.
  35. // - ip: Equivalent as "ip_source" and "ip_target", selects both source and
  36. // target IP.
  37. // - port: Equivalent as "port_source" and "port_target", selects both source
  38. // and target port.
  39. // - domain: Selects target domain.
  40. // - protocol: Select connection's protocol.
  41. // - user: Select connection's inbound user email.
  42. // - attributes: Select connection's additional attributes.
  43. // - outbound: Equivalent as "outbound" and "outbound_group", select both
  44. // outbound tag and outbound group tags.
  45. // * If FieldSelectors is left empty, all fields will be returned.
  46. message SubscribeRoutingStatsRequest {
  47. repeated string FieldSelectors = 1;
  48. }
  49. // TestRouteRequest manually tests a routing result according to the routing
  50. // context message.
  51. // * RoutingContext is the routing message without outbound information.
  52. // * FieldSelectors selects the fields to return in the routing result. All
  53. // fields are returned if left empty.
  54. // * PublishResult broadcasts the routing result to routing statistics channel
  55. // if set true.
  56. message TestRouteRequest {
  57. RoutingContext RoutingContext = 1;
  58. repeated string FieldSelectors = 2;
  59. bool PublishResult = 3;
  60. }
  61. message PrincipleTargetInfo {
  62. repeated string tag = 1;
  63. }
  64. message OverrideInfo {
  65. string target = 2;
  66. }
  67. message BalancerMsg {
  68. OverrideInfo override = 5;
  69. PrincipleTargetInfo principle_target = 6;
  70. }
  71. message GetBalancerInfoRequest {
  72. string tag = 1;
  73. }
  74. message GetBalancerInfoResponse {
  75. BalancerMsg balancer = 1;
  76. }
  77. message OverrideBalancerTargetRequest {
  78. string balancerTag = 1;
  79. string target = 2;
  80. }
  81. message OverrideBalancerTargetResponse {}
  82. message AddRuleRequest {
  83. xray.common.serial.TypedMessage config = 1;
  84. bool shouldAppend = 2;
  85. }
  86. message AddRuleResponse {}
  87. message RemoveRuleRequest {
  88. string ruleTag = 1;
  89. }
  90. message RemoveRuleResponse {}
  91. service RoutingService {
  92. rpc SubscribeRoutingStats(SubscribeRoutingStatsRequest)
  93. returns (stream RoutingContext) {}
  94. rpc TestRoute(TestRouteRequest) returns (RoutingContext) {}
  95. rpc GetBalancerInfo(GetBalancerInfoRequest) returns (GetBalancerInfoResponse){}
  96. rpc OverrideBalancerTarget(OverrideBalancerTargetRequest) returns (OverrideBalancerTargetResponse) {}
  97. rpc AddRule(AddRuleRequest) returns (AddRuleResponse) {}
  98. rpc RemoveRule(RemoveRuleRequest) returns (RemoveRuleResponse) {}
  99. }
  100. message Config {}