types.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * Some interface for clash api
  3. */
  4. export namespace ApiType {
  5. export interface ConfigData {
  6. port: number;
  7. mode: string;
  8. ipv6: boolean;
  9. "socket-port": number;
  10. "allow-lan": boolean;
  11. "log-level": string;
  12. "mixed-port": number;
  13. "redir-port": number;
  14. "socks-port": number;
  15. "tproxy-port": number;
  16. }
  17. export interface RuleItem {
  18. type: string;
  19. payload: string;
  20. proxy: string;
  21. }
  22. export interface ProxyItem {
  23. name: string;
  24. type: string;
  25. udp: boolean;
  26. history: {
  27. time: string;
  28. delay: number;
  29. }[];
  30. all?: string[];
  31. now?: string;
  32. }
  33. export type ProxyGroupItem = Omit<ProxyItem, "all"> & {
  34. all: ProxyItem[];
  35. };
  36. export interface TrafficItem {
  37. up: number;
  38. down: number;
  39. }
  40. export interface LogItem {
  41. type: string;
  42. time?: string;
  43. payload: string;
  44. }
  45. export interface ConnectionsItem {
  46. id: string;
  47. metadata: {
  48. network: string;
  49. type: string;
  50. host: string;
  51. sourceIP: string;
  52. sourcePort: string;
  53. destinationPort: string;
  54. destinationIP?: string;
  55. };
  56. upload: number;
  57. download: number;
  58. start: string;
  59. chains: string[];
  60. rule: string;
  61. rulePayload: string;
  62. }
  63. export interface Connections {
  64. downloadTotal: number;
  65. uploadTotal: number;
  66. connections: ConnectionsItem[];
  67. }
  68. }
  69. /**
  70. * Some interface for command
  71. */
  72. export namespace CmdType {
  73. export interface ClashInfo {
  74. status: string;
  75. port?: string;
  76. server?: string;
  77. secret?: string;
  78. }
  79. export interface ProfileItem {
  80. uid: string;
  81. type?: string;
  82. name?: string;
  83. desc?: string;
  84. file?: string;
  85. url?: string;
  86. updated?: number;
  87. selected?: {
  88. name?: string;
  89. now?: string;
  90. }[];
  91. extra?: {
  92. upload: number;
  93. download: number;
  94. total: number;
  95. expire: number;
  96. };
  97. }
  98. export interface ProfilesConfig {
  99. current?: string;
  100. chain?: string[];
  101. items?: ProfileItem[];
  102. }
  103. export interface VergeConfig {
  104. theme_mode?: "light" | "dark";
  105. theme_blur?: boolean;
  106. traffic_graph?: boolean;
  107. enable_tun_mode?: boolean;
  108. enable_auto_launch?: boolean;
  109. enable_system_proxy?: boolean;
  110. enable_proxy_guard?: boolean;
  111. system_proxy_bypass?: string;
  112. }
  113. export interface ChainItem {
  114. item: ProfileItem;
  115. merge?: object;
  116. script?: string;
  117. }
  118. export interface EnhancedPayload {
  119. chain: ChainItem[];
  120. current: object;
  121. }
  122. }