types.d.ts 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. type Platform =
  2. | "aix"
  3. | "android"
  4. | "darwin"
  5. | "freebsd"
  6. | "haiku"
  7. | "linux"
  8. | "openbsd"
  9. | "sunos"
  10. | "win32"
  11. | "cygwin"
  12. | "netbsd";
  13. /**
  14. * defines in `vite.config.ts`
  15. */
  16. declare const OS_PLATFORM: Platform;
  17. /**
  18. * Some interface for clash api
  19. */
  20. interface IConfigData {
  21. port: number;
  22. mode: string;
  23. ipv6: boolean;
  24. "socket-port": number;
  25. "allow-lan": boolean;
  26. "log-level": string;
  27. "mixed-port": number;
  28. "redir-port": number;
  29. "socks-port": number;
  30. "tproxy-port": number;
  31. "external-controller": string;
  32. secret: string;
  33. tun: {
  34. stack: string;
  35. device: string;
  36. "auto-route": boolean;
  37. "auto-detect-interface": boolean;
  38. "dns-hijack": string[];
  39. "strict-route": boolean;
  40. mtu: number;
  41. };
  42. }
  43. interface IRuleItem {
  44. type: string;
  45. payload: string;
  46. proxy: string;
  47. }
  48. interface IProxyItem {
  49. name: string;
  50. type: string;
  51. udp: boolean;
  52. xudp: boolean;
  53. tfo: boolean;
  54. history: {
  55. time: string;
  56. delay: number;
  57. }[];
  58. all?: string[];
  59. now?: string;
  60. hidden?: boolean;
  61. icon?: string;
  62. provider?: string; // 记录是否来自provider
  63. fixed?: string; // 记录固定(优先)的节点
  64. }
  65. type IProxyGroupItem = Omit<IProxyItem, "all"> & {
  66. all: IProxyItem[];
  67. };
  68. interface IProxyProviderItem {
  69. name: string;
  70. type: string;
  71. proxies: IProxyItem[];
  72. updatedAt: string;
  73. vehicleType: string;
  74. subscriptionInfo?: {
  75. Upload: number;
  76. Download: number;
  77. Total: number;
  78. Expire: number;
  79. };
  80. }
  81. interface IRuleProviderItem {
  82. name: string;
  83. behavior: string;
  84. format: string;
  85. ruleCount: number;
  86. type: string;
  87. updatedAt: string;
  88. vehicleType: string;
  89. }
  90. interface ITrafficItem {
  91. up: number;
  92. down: number;
  93. }
  94. interface ILogItem {
  95. type: string;
  96. time?: string;
  97. payload: string;
  98. }
  99. interface IConnectionsItem {
  100. id: string;
  101. metadata: {
  102. network: string;
  103. type: string;
  104. host: string;
  105. sourceIP: string;
  106. sourcePort: string;
  107. destinationPort: string;
  108. destinationIP?: string;
  109. process?: string;
  110. processPath?: string;
  111. };
  112. upload: number;
  113. download: number;
  114. start: string;
  115. chains: string[];
  116. rule: string;
  117. rulePayload: string;
  118. curUpload?: number; // upload speed, calculate at runtime
  119. curDownload?: number; // download speed, calculate at runtime
  120. }
  121. interface IConnections {
  122. downloadTotal: number;
  123. uploadTotal: number;
  124. connections: IConnectionsItem[];
  125. }
  126. /**
  127. * Some interface for command
  128. */
  129. interface IClashInfo {
  130. // status: string;
  131. mixed_port?: number; // clash mixed port
  132. socks_port?: number; // clash socks port
  133. redir_port?: number; // clash redir port
  134. tproxy_port?: number; // clash tproxy port
  135. port?: number; // clash http port
  136. server?: string; // external-controller
  137. secret?: string;
  138. }
  139. interface IProfileItem {
  140. uid: string;
  141. type?: "local" | "remote" | "merge" | "script";
  142. name?: string;
  143. desc?: string;
  144. file?: string;
  145. url?: string;
  146. updated?: number;
  147. selected?: {
  148. name?: string;
  149. now?: string;
  150. }[];
  151. extra?: {
  152. upload: number;
  153. download: number;
  154. total: number;
  155. expire: number;
  156. };
  157. option?: IProfileOption;
  158. home?: string;
  159. }
  160. interface IProfileOption {
  161. user_agent?: string;
  162. with_proxy?: boolean;
  163. self_proxy?: boolean;
  164. update_interval?: number;
  165. danger_accept_invalid_certs?: boolean;
  166. merge?: string;
  167. script?: string;
  168. rules?: string;
  169. proxies?: string;
  170. groups?: string;
  171. }
  172. interface IProfilesConfig {
  173. current?: string;
  174. valid?: string[];
  175. items?: IProfileItem[];
  176. }
  177. interface IVergeTestItem {
  178. uid: string;
  179. name?: string;
  180. icon?: string;
  181. url: string;
  182. }
  183. interface ISeqProfileConfig {
  184. prepend: string[];
  185. append: string[];
  186. delete: string[];
  187. }
  188. interface IVergeConfig {
  189. app_log_level?: "trace" | "debug" | "info" | "warn" | "error" | string;
  190. language?: string;
  191. tray_event?: "main_window" | "system_proxy" | "tun_mode" | string;
  192. env_type?: "bash" | "cmd" | "powershell" | string;
  193. startup_script?: string;
  194. start_page?: string;
  195. clash_core?: string;
  196. theme_mode?: "light" | "dark" | "system";
  197. traffic_graph?: boolean;
  198. enable_memory_usage?: boolean;
  199. enable_group_icon?: boolean;
  200. menu_icon?: "monochrome" | "colorful" | "disable";
  201. tray_icon?: "monochrome" | "colorful";
  202. common_tray_icon?: boolean;
  203. sysproxy_tray_icon?: boolean;
  204. tun_tray_icon?: boolean;
  205. enable_tun_mode?: boolean;
  206. enable_auto_launch?: boolean;
  207. enable_service_mode?: boolean;
  208. enable_silent_start?: boolean;
  209. enable_system_proxy?: boolean;
  210. proxy_auto_config?: boolean;
  211. pac_file_content?: string;
  212. enable_random_port?: boolean;
  213. verge_mixed_port?: number;
  214. verge_socks_port?: number;
  215. verge_redir_port?: number;
  216. verge_tproxy_port?: number;
  217. verge_port?: number;
  218. verge_redir_enabled?: boolean;
  219. verge_tproxy_enabled?: boolean;
  220. verge_socks_enabled?: boolean;
  221. verge_http_enabled?: boolean;
  222. enable_proxy_guard?: boolean;
  223. use_default_bypass?: boolean;
  224. proxy_guard_duration?: number;
  225. system_proxy_bypass?: string;
  226. web_ui_list?: string[];
  227. hotkeys?: string[];
  228. theme_setting?: {
  229. primary_color?: string;
  230. secondary_color?: string;
  231. primary_text?: string;
  232. secondary_text?: string;
  233. info_color?: string;
  234. error_color?: string;
  235. warning_color?: string;
  236. success_color?: string;
  237. font_family?: string;
  238. css_injection?: string;
  239. };
  240. auto_close_connection?: boolean;
  241. auto_check_update?: boolean;
  242. default_latency_test?: string;
  243. default_latency_timeout?: number;
  244. enable_builtin_enhanced?: boolean;
  245. auto_log_clean?: 0 | 1 | 2 | 3;
  246. proxy_layout_column?: number;
  247. test_list?: IVergeTestItem[];
  248. }