started_service.proto 4.6 KB

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