types.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. name?: string;
  81. file?: string;
  82. mode?: string;
  83. url?: string;
  84. updated?: number;
  85. selected?: {
  86. name?: string;
  87. now?: string;
  88. }[];
  89. extra?: {
  90. upload: number;
  91. download: number;
  92. total: number;
  93. expire: number;
  94. };
  95. }
  96. export interface ProfilesConfig {
  97. current?: number;
  98. items?: ProfileItem[];
  99. }
  100. export interface VergeConfig {
  101. theme_mode?: "light" | "dark";
  102. enable_self_startup?: boolean;
  103. enable_system_proxy?: boolean;
  104. }
  105. }