started_service.proto 4.5 KB

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