command.proto 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. }
  26. // SubscribeRoutingStatsRequest subscribes to routing statistics channel if
  27. // opened by xray-core.
  28. // * FieldSelectors selects a subset of fields in routing statistics to return.
  29. // Valid selectors:
  30. // - inbound: Selects connection's inbound tag.
  31. // - network: Selects connection's network.
  32. // - ip: Equivalent as "ip_source" and "ip_target", selects both source and
  33. // target IP.
  34. // - port: Equivalent as "port_source" and "port_target", selects both source
  35. // and target port.
  36. // - domain: Selects target domain.
  37. // - protocol: Select connection's protocol.
  38. // - user: Select connection's inbound user email.
  39. // - attributes: Select connection's additional attributes.
  40. // - outbound: Equivalent as "outbound" and "outbound_group", select both
  41. // outbound tag and outbound group tags.
  42. // * If FieldSelectors is left empty, all fields will be returned.
  43. message SubscribeRoutingStatsRequest {
  44. repeated string FieldSelectors = 1;
  45. }
  46. // TestRouteRequest manually tests a routing result according to the routing
  47. // context message.
  48. // * RoutingContext is the routing message without outbound information.
  49. // * FieldSelectors selects the fields to return in the routing result. All
  50. // fields are returned if left empty.
  51. // * PublishResult broadcasts the routing result to routing statistics channel
  52. // if set true.
  53. message TestRouteRequest {
  54. RoutingContext RoutingContext = 1;
  55. repeated string FieldSelectors = 2;
  56. bool PublishResult = 3;
  57. }
  58. message PrincipleTargetInfo {
  59. repeated string tag = 1;
  60. }
  61. message OverrideInfo {
  62. string target = 2;
  63. }
  64. message BalancerMsg {
  65. OverrideInfo override = 5;
  66. PrincipleTargetInfo principle_target = 6;
  67. }
  68. message GetBalancerInfoRequest {
  69. string tag = 1;
  70. }
  71. message GetBalancerInfoResponse {
  72. BalancerMsg balancer = 1;
  73. }
  74. message OverrideBalancerTargetRequest {
  75. string balancerTag = 1;
  76. string target = 2;
  77. }
  78. message OverrideBalancerTargetResponse {}
  79. message AddRuleRequest {
  80. xray.common.serial.TypedMessage config = 1;
  81. bool shouldAppend = 2;
  82. }
  83. message AddRuleResponse {}
  84. message RemoveRuleRequest {
  85. string ruleTag = 1;
  86. }
  87. message RemoveRuleResponse {}
  88. service RoutingService {
  89. rpc SubscribeRoutingStats(SubscribeRoutingStatsRequest)
  90. returns (stream RoutingContext) {}
  91. rpc TestRoute(TestRouteRequest) returns (RoutingContext) {}
  92. rpc GetBalancerInfo(GetBalancerInfoRequest) returns (GetBalancerInfoResponse){}
  93. rpc OverrideBalancerTarget(OverrideBalancerTargetRequest) returns (OverrideBalancerTargetResponse) {}
  94. rpc AddRule(AddRuleRequest) returns (AddRuleResponse) {}
  95. rpc RemoveRule(RemoveRuleRequest) returns (RemoveRuleResponse) {}
  96. }
  97. message Config {}