started_service.proto 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. syntax = "proto3";
  2. package daemon;
  3. option go_package = "github.com/sagernet/sing-box/daemon";
  4. import "google/protobuf/empty.proto";
  5. import "daemon/helper.proto";
  6. service StartedService {
  7. rpc StopService(google.protobuf.Empty) returns (google.protobuf.Empty);
  8. rpc ReloadService(google.protobuf.Empty) returns (google.protobuf.Empty);
  9. rpc SubscribeServiceStatus(google.protobuf.Empty) returns(stream ServiceStatus) {}
  10. rpc SubscribeLog(google.protobuf.Empty) returns(stream Log) {}
  11. rpc GetDefaultLogLevel(google.protobuf.Empty) returns(DefaultLogLevel) {}
  12. rpc SubscribeStatus(SubscribeStatusRequest) returns(stream Status) {}
  13. rpc SubscribeGroups(google.protobuf.Empty) returns(stream Groups) {}
  14. rpc GetClashModeStatus(google.protobuf.Empty) returns(ClashModeStatus) {}
  15. rpc SubscribeClashMode(google.protobuf.Empty) returns(stream ClashMode) {}
  16. rpc SetClashMode(ClashMode) returns(google.protobuf.Empty) {}
  17. rpc URLTest(URLTestRequest) returns(google.protobuf.Empty) {}
  18. rpc SelectOutbound(SelectOutboundRequest) returns (google.protobuf.Empty) {}
  19. rpc SetGroupExpand(SetGroupExpandRequest) returns (google.protobuf.Empty) {}
  20. rpc GetSystemProxyStatus(google.protobuf.Empty) returns(SystemProxyStatus) {}
  21. rpc SetSystemProxyEnabled(SetSystemProxyEnabledRequest) returns(google.protobuf.Empty) {}
  22. rpc SubscribeConnections(SubscribeConnectionsRequest) returns(stream Connections) {}
  23. rpc CloseConnection(CloseConnectionRequest) returns(google.protobuf.Empty) {}
  24. rpc CloseAllConnections(google.protobuf.Empty) returns(google.protobuf.Empty) {}
  25. rpc GetDeprecatedWarnings(google.protobuf.Empty) returns(DeprecatedWarnings) {}
  26. rpc SubscribeHelperEvents(google.protobuf.Empty) returns(stream HelperRequest) {}
  27. rpc SendHelperResponse(HelperResponse) returns(google.protobuf.Empty) {}
  28. }
  29. message ServiceStatus {
  30. enum Type {
  31. IDLE = 0;
  32. STARTING = 1;
  33. STARTED = 2;
  34. STOPPING = 3;
  35. FATAL = 4;
  36. }
  37. Type status = 1;
  38. string errorMessage = 2;
  39. }
  40. message ReloadServiceRequest {
  41. string newProfileContent = 1;
  42. }
  43. message SubscribeStatusRequest {
  44. int64 interval = 1;
  45. }
  46. enum LogLevel {
  47. PANIC = 0;
  48. FATAL = 1;
  49. ERROR = 2;
  50. WARN = 3;
  51. INFO = 4;
  52. DEBUG = 5;
  53. TRACE = 6;
  54. }
  55. message Log {
  56. repeated Message messages = 1;
  57. bool reset = 2;
  58. message Message {
  59. LogLevel level = 1;
  60. string message = 2;
  61. }
  62. }
  63. message DefaultLogLevel {
  64. LogLevel level = 1;
  65. }
  66. message Status {
  67. uint64 memory = 1;
  68. int32 goroutines = 2;
  69. int32 connectionsIn = 3;
  70. int32 connectionsOut = 4;
  71. bool trafficAvailable = 5;
  72. int64 uplink = 6;
  73. int64 downlink = 7;
  74. int64 uplinkTotal = 8;
  75. int64 downlinkTotal = 9;
  76. }
  77. message Groups {
  78. repeated Group group = 1;
  79. }
  80. message Group {
  81. string tag = 1;
  82. string type = 2;
  83. bool selectable = 3;
  84. string selected = 4;
  85. bool isExpand = 5;
  86. repeated GroupItem items = 6;
  87. }
  88. message GroupItem {
  89. string tag = 1;
  90. string type = 2;
  91. int64 urlTestTime = 3;
  92. int32 urlTestDelay = 4;
  93. }
  94. message URLTestRequest {
  95. string outboundTag = 1;
  96. }
  97. message SelectOutboundRequest {
  98. string groupTag = 1;
  99. string outboundTag = 2;
  100. }
  101. message SetGroupExpandRequest {
  102. string groupTag = 1;
  103. bool isExpand = 2;
  104. }
  105. message ClashMode {
  106. string mode = 3;
  107. }
  108. message ClashModeStatus {
  109. repeated string modeList = 1;
  110. string currentMode = 2;
  111. }
  112. message SystemProxyStatus {
  113. bool available = 1;
  114. bool enabled = 2;
  115. }
  116. message SetSystemProxyEnabledRequest {
  117. bool enabled = 1;
  118. }
  119. message SubscribeConnectionsRequest {
  120. int64 interval = 1;
  121. ConnectionFilter filter = 2;
  122. ConnectionSortBy sortBy = 3;
  123. }
  124. enum ConnectionFilter {
  125. ALL = 0;
  126. ACTIVE = 1;
  127. CLOSED = 2;
  128. }
  129. enum ConnectionSortBy {
  130. DATE = 0;
  131. TRAFFIC = 1;
  132. TOTAL_TRAFFIC = 2;
  133. }
  134. message Connections {
  135. repeated Connection connections = 1;
  136. }
  137. message Connection {
  138. string id = 1;
  139. string inbound = 2;
  140. string inboundType = 3;
  141. int32 ipVersion = 4;
  142. string network = 5;
  143. string source = 6;
  144. string destination = 7;
  145. string domain = 8;
  146. string protocol = 9;
  147. string user = 10;
  148. string fromOutbound = 11;
  149. int64 createdAt = 12;
  150. int64 closedAt = 13;
  151. int64 uplink = 14;
  152. int64 downlink = 15;
  153. int64 uplinkTotal = 16;
  154. int64 downlinkTotal = 17;
  155. string rule = 18;
  156. string outbound = 19;
  157. string outboundType = 20;
  158. repeated string chainList = 21;
  159. }
  160. message CloseConnectionRequest {
  161. string id = 1;
  162. }
  163. message DeprecatedWarnings {
  164. repeated DeprecatedWarning warnings = 1;
  165. }
  166. message DeprecatedWarning {
  167. string message = 1;
  168. bool impending = 2;
  169. string migrationLink = 3;
  170. }