zod.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. // Code generated by tools/openapigen. DO NOT EDIT.
  2. import { z } from 'zod';
  3. export const GeoKindSchema = z.string();
  4. export type GeoKind = z.infer<typeof GeoKindSchema>;
  5. export const OnlineAPISupportSchema = z.number().int();
  6. export type OnlineAPISupport = z.infer<typeof OnlineAPISupportSchema>;
  7. export const ProcessStateSchema = z.string();
  8. export type ProcessState = z.infer<typeof ProcessStateSchema>;
  9. export const ProtocolSchema = z.string();
  10. export type Protocol = z.infer<typeof ProtocolSchema>;
  11. export const SubLinkProviderSchema = z.unknown();
  12. export type SubLinkProvider = z.infer<typeof SubLinkProviderSchema>;
  13. export const staticEgressResolverSchema = z.string();
  14. export type staticEgressResolver = z.infer<typeof staticEgressResolverSchema>;
  15. export const trafficLocalApplyActionSchema = z.number().int();
  16. export type trafficLocalApplyAction = z.infer<typeof trafficLocalApplyActionSchema>;
  17. export const transportBitsSchema = z.number().int();
  18. export type transportBits = z.infer<typeof transportBitsSchema>;
  19. export const AllSettingSchema = z.object({
  20. datepicker: z.string(),
  21. expireDiff: z.number().int().min(0),
  22. externalTrafficInformEnable: z.boolean(),
  23. externalTrafficInformURI: z.string(),
  24. ldapAutoCreate: z.boolean(),
  25. ldapAutoDelete: z.boolean(),
  26. ldapBaseDN: z.string(),
  27. ldapBindDN: z.string(),
  28. ldapDefaultExpiryDays: z.number().int().min(0),
  29. ldapDefaultLimitIP: z.number().int().min(0),
  30. ldapDefaultTotalGB: z.number().int().min(0),
  31. ldapEnable: z.boolean(),
  32. ldapFlagField: z.string(),
  33. ldapHost: z.string(),
  34. ldapInboundTags: z.string(),
  35. ldapInsecureSkipVerify: z.boolean(),
  36. ldapInvertFlag: z.boolean(),
  37. ldapPassword: z.string(),
  38. ldapPort: z.number().int().min(0).max(65535),
  39. ldapSyncCron: z.string(),
  40. ldapTruthyValues: z.string(),
  41. ldapUseTLS: z.boolean(),
  42. ldapUserAttr: z.string(),
  43. ldapUserFilter: z.string(),
  44. ldapVlessField: z.string(),
  45. outboundDownThreshold: z.number().int().min(1).max(100),
  46. pageSize: z.number().int().min(0).max(1000),
  47. panelOutbound: z.string(),
  48. remarkTemplate: z.string(),
  49. restartXrayOnClientDisable: z.boolean(),
  50. sessionMaxAge: z.number().int().min(1).max(525600),
  51. smtpCpu: z.number().int().min(0).max(100),
  52. smtpEnable: z.boolean(),
  53. smtpEnabledEvents: z.string(),
  54. smtpEncryptionType: z.string(),
  55. smtpFrom: z.string(),
  56. smtpFromName: z.string(),
  57. smtpHost: z.string(),
  58. smtpMemory: z.number().int().min(0).max(100),
  59. smtpPassword: z.string(),
  60. smtpPort: z.number().int().min(1).max(65535),
  61. smtpTo: z.string(),
  62. smtpUsername: z.string(),
  63. subAnnounce: z.string(),
  64. subCertFile: z.string(),
  65. subClashAutoDetect: z.boolean(),
  66. subClashEnable: z.boolean(),
  67. subClashEnableRouting: z.boolean(),
  68. subClashPath: z.string(),
  69. subClashRules: z.string(),
  70. subClashURI: z.string(),
  71. subClashUserAgentRegex: z.string(),
  72. subDomain: z.string(),
  73. subEnable: z.boolean(),
  74. subEnableRouting: z.boolean(),
  75. subEncrypt: z.boolean(),
  76. subHideSettings: z.boolean(),
  77. subIncyEnableRouting: z.boolean(),
  78. subIncyRoutingRules: z.string(),
  79. subJsonAlwaysArray: z.boolean(),
  80. subJsonAutoDetect: z.boolean(),
  81. subJsonEnable: z.boolean(),
  82. subJsonFinalMask: z.string(),
  83. subJsonMux: z.string(),
  84. subJsonPath: z.string(),
  85. subJsonRules: z.string(),
  86. subJsonURI: z.string(),
  87. subJsonUserAgentRegex: z.string(),
  88. subKeyFile: z.string(),
  89. subListen: z.string(),
  90. subPath: z.string(),
  91. subPort: z.number().int().min(1).max(65535),
  92. subProfileUrl: z.string(),
  93. subRoutingRules: z.string(),
  94. subShowIdentityOnAllLinks: z.boolean(),
  95. subSupportUrl: z.string(),
  96. subThemeDir: z.string(),
  97. subTitle: z.string(),
  98. subURI: z.string(),
  99. subUpdates: z.number().int().min(0).max(525600),
  100. tgBotAPIServer: z.string(),
  101. tgBotBackup: z.boolean(),
  102. tgBotChatId: z.string(),
  103. tgBotEnable: z.boolean(),
  104. tgBotProxy: z.string(),
  105. tgBotToken: z.string(),
  106. tgCpu: z.number().int().min(0).max(100),
  107. tgEnabledEvents: z.string(),
  108. tgLang: z.string(),
  109. tgMemory: z.number().int().min(0).max(100),
  110. tgRunTime: z.string(),
  111. timeLocation: z.string(),
  112. trafficDiff: z.number().int().min(0).max(100),
  113. trustedProxyCIDRs: z.string(),
  114. twoFactorEnable: z.boolean(),
  115. twoFactorToken: z.string(),
  116. warpUpdateInterval: z.number().int().min(0),
  117. webBasePath: z.string(),
  118. webCertFile: z.string(),
  119. webDomain: z.string(),
  120. webKeyFile: z.string(),
  121. webListen: z.string(),
  122. webPort: z.number().int().min(1).max(65535),
  123. });
  124. export type AllSetting = z.infer<typeof AllSettingSchema>;
  125. export const AllSettingViewSchema = z.object({
  126. datepicker: z.string(),
  127. expireDiff: z.number().int().min(0),
  128. externalTrafficInformEnable: z.boolean(),
  129. externalTrafficInformURI: z.string(),
  130. hasApiToken: z.boolean(),
  131. hasLdapPassword: z.boolean(),
  132. hasNordSecret: z.boolean(),
  133. hasSmtpPassword: z.boolean(),
  134. hasTgBotToken: z.boolean(),
  135. hasTwoFactorToken: z.boolean(),
  136. hasWarpSecret: z.boolean(),
  137. ldapAutoCreate: z.boolean(),
  138. ldapAutoDelete: z.boolean(),
  139. ldapBaseDN: z.string(),
  140. ldapBindDN: z.string(),
  141. ldapDefaultExpiryDays: z.number().int().min(0),
  142. ldapDefaultLimitIP: z.number().int().min(0),
  143. ldapDefaultTotalGB: z.number().int().min(0),
  144. ldapEnable: z.boolean(),
  145. ldapFlagField: z.string(),
  146. ldapHost: z.string(),
  147. ldapInboundTags: z.string(),
  148. ldapInsecureSkipVerify: z.boolean(),
  149. ldapInvertFlag: z.boolean(),
  150. ldapPassword: z.string(),
  151. ldapPort: z.number().int().min(0).max(65535),
  152. ldapSyncCron: z.string(),
  153. ldapTruthyValues: z.string(),
  154. ldapUseTLS: z.boolean(),
  155. ldapUserAttr: z.string(),
  156. ldapUserFilter: z.string(),
  157. ldapVlessField: z.string(),
  158. outboundDownThreshold: z.number().int().min(1).max(100),
  159. pageSize: z.number().int().min(0).max(1000),
  160. panelOutbound: z.string(),
  161. remarkTemplate: z.string(),
  162. restartXrayOnClientDisable: z.boolean(),
  163. sessionMaxAge: z.number().int().min(1).max(525600),
  164. smtpCpu: z.number().int().min(0).max(100),
  165. smtpEnable: z.boolean(),
  166. smtpEnabledEvents: z.string(),
  167. smtpEncryptionType: z.string(),
  168. smtpFrom: z.string(),
  169. smtpFromName: z.string(),
  170. smtpHost: z.string(),
  171. smtpMemory: z.number().int().min(0).max(100),
  172. smtpPassword: z.string(),
  173. smtpPort: z.number().int().min(1).max(65535),
  174. smtpTo: z.string(),
  175. smtpUsername: z.string(),
  176. subAnnounce: z.string(),
  177. subCertFile: z.string(),
  178. subClashAutoDetect: z.boolean(),
  179. subClashEnable: z.boolean(),
  180. subClashEnableRouting: z.boolean(),
  181. subClashPath: z.string(),
  182. subClashRules: z.string(),
  183. subClashURI: z.string(),
  184. subClashUserAgentRegex: z.string(),
  185. subDomain: z.string(),
  186. subEnable: z.boolean(),
  187. subEnableRouting: z.boolean(),
  188. subEncrypt: z.boolean(),
  189. subHideSettings: z.boolean(),
  190. subIncyEnableRouting: z.boolean(),
  191. subIncyRoutingRules: z.string(),
  192. subJsonAlwaysArray: z.boolean(),
  193. subJsonAutoDetect: z.boolean(),
  194. subJsonEnable: z.boolean(),
  195. subJsonFinalMask: z.string(),
  196. subJsonMux: z.string(),
  197. subJsonPath: z.string(),
  198. subJsonRules: z.string(),
  199. subJsonURI: z.string(),
  200. subJsonUserAgentRegex: z.string(),
  201. subKeyFile: z.string(),
  202. subListen: z.string(),
  203. subPath: z.string(),
  204. subPort: z.number().int().min(1).max(65535),
  205. subProfileUrl: z.string(),
  206. subRoutingRules: z.string(),
  207. subShowIdentityOnAllLinks: z.boolean(),
  208. subSupportUrl: z.string(),
  209. subThemeDir: z.string(),
  210. subTitle: z.string(),
  211. subURI: z.string(),
  212. subUpdates: z.number().int().min(0).max(525600),
  213. tgBotAPIServer: z.string(),
  214. tgBotBackup: z.boolean(),
  215. tgBotChatId: z.string(),
  216. tgBotEnable: z.boolean(),
  217. tgBotProxy: z.string(),
  218. tgBotToken: z.string(),
  219. tgCpu: z.number().int().min(0).max(100),
  220. tgEnabledEvents: z.string(),
  221. tgLang: z.string(),
  222. tgMemory: z.number().int().min(0).max(100),
  223. tgRunTime: z.string(),
  224. timeLocation: z.string(),
  225. trafficDiff: z.number().int().min(0).max(100),
  226. trustedProxyCIDRs: z.string(),
  227. twoFactorEnable: z.boolean(),
  228. twoFactorToken: z.string(),
  229. warpUpdateInterval: z.number().int().min(0),
  230. webBasePath: z.string(),
  231. webCertFile: z.string(),
  232. webDomain: z.string(),
  233. webKeyFile: z.string(),
  234. webListen: z.string(),
  235. webPort: z.number().int().min(1).max(65535),
  236. });
  237. export type AllSettingView = z.infer<typeof AllSettingViewSchema>;
  238. export const ApiTokenSchema = z.object({
  239. createdAt: z.number().int(),
  240. enabled: z.boolean(),
  241. expiresAt: z.number().int(),
  242. id: z.number().int(),
  243. name: z.string(),
  244. scope: z.string(),
  245. token: z.string(),
  246. });
  247. export type ApiToken = z.infer<typeof ApiTokenSchema>;
  248. export const ApiTokenViewSchema = z.object({
  249. createdAt: z.number().int(),
  250. enabled: z.boolean(),
  251. expiresAt: z.number().int(),
  252. id: z.number().int(),
  253. name: z.string(),
  254. scope: z.string(),
  255. token: z.string().optional(),
  256. });
  257. export type ApiTokenView = z.infer<typeof ApiTokenViewSchema>;
  258. export const ClientSchema = z.object({
  259. adTag: z.string().optional(),
  260. allowedIPs: z.array(z.string()).optional(),
  261. auth: z.string().optional(),
  262. comment: z.string(),
  263. created_at: z.number().int().optional(),
  264. email: z.string(),
  265. enable: z.boolean(),
  266. expiryTime: z.number().int(),
  267. flow: z.string().optional(),
  268. group: z.string().optional(),
  269. id: z.string().optional(),
  270. keepAlive: z.number().int().optional(),
  271. limitIp: z.number().int(),
  272. password: z.string().optional(),
  273. preSharedKey: z.string().optional(),
  274. privateKey: z.string().optional(),
  275. publicKey: z.string().optional(),
  276. reset: z.number().int(),
  277. reverse: z.lazy(() => ClientReverseSchema).nullable().optional(),
  278. secret: z.string().optional(),
  279. security: z.string(),
  280. subId: z.string(),
  281. tgId: z.number().int(),
  282. totalGB: z.number().int(),
  283. updated_at: z.number().int().optional(),
  284. });
  285. export type Client = z.infer<typeof ClientSchema>;
  286. export const ClientInboundSchema = z.object({
  287. clientId: z.number().int(),
  288. createdAt: z.number().int(),
  289. flowOverride: z.string(),
  290. inboundId: z.number().int(),
  291. });
  292. export type ClientInbound = z.infer<typeof ClientInboundSchema>;
  293. export const ClientRecordSchema = z.object({
  294. adTag: z.string(),
  295. allowedIPs: z.string(),
  296. auth: z.string(),
  297. comment: z.string(),
  298. createdAt: z.number().int(),
  299. email: z.string(),
  300. enable: z.boolean(),
  301. expiryTime: z.number().int(),
  302. flow: z.string(),
  303. group: z.string(),
  304. id: z.number().int(),
  305. keepAlive: z.number().int(),
  306. limitHwid: z.number().int(),
  307. limitIp: z.number().int(),
  308. password: z.string(),
  309. preSharedKey: z.string(),
  310. privateKey: z.string(),
  311. publicKey: z.string(),
  312. reset: z.number().int(),
  313. reverse: z.unknown(),
  314. secret: z.string(),
  315. security: z.string(),
  316. subId: z.string(),
  317. tgId: z.number().int(),
  318. totalGB: z.number().int(),
  319. updatedAt: z.number().int(),
  320. uuid: z.string(),
  321. });
  322. export type ClientRecord = z.infer<typeof ClientRecordSchema>;
  323. export const ClientReverseSchema = z.object({
  324. tag: z.string(),
  325. });
  326. export type ClientReverse = z.infer<typeof ClientReverseSchema>;
  327. export const ClientTrafficSchema = z.object({
  328. down: z.number().int(),
  329. email: z.string(),
  330. enable: z.boolean(),
  331. expiryTime: z.number().int(),
  332. id: z.number().int(),
  333. inboundId: z.number().int(),
  334. lastOnline: z.number().int(),
  335. lastSubFetch: z.number().int(),
  336. reset: z.number().int(),
  337. subId: z.string(),
  338. total: z.number().int(),
  339. up: z.number().int(),
  340. uuid: z.string(),
  341. });
  342. export type ClientTraffic = z.infer<typeof ClientTrafficSchema>;
  343. export const FallbackParentInfoSchema = z.object({
  344. masterId: z.number().int(),
  345. path: z.string().optional(),
  346. });
  347. export type FallbackParentInfo = z.infer<typeof FallbackParentInfoSchema>;
  348. export const GeoCategorySchema = z.object({
  349. attributes: z.array(z.string()),
  350. code: z.string(),
  351. entries: z.number().int(),
  352. });
  353. export type GeoCategory = z.infer<typeof GeoCategorySchema>;
  354. export const GeoCategoryPageSchema = z.object({
  355. items: z.array(z.lazy(() => GeoCategorySchema)),
  356. total: z.number().int(),
  357. });
  358. export type GeoCategoryPage = z.infer<typeof GeoCategoryPageSchema>;
  359. export const GeoEntrySchema = z.object({
  360. kind: z.string(),
  361. value: z.string(),
  362. });
  363. export type GeoEntry = z.infer<typeof GeoEntrySchema>;
  364. export const GeoEntryPageSchema = z.object({
  365. items: z.array(z.lazy(() => GeoEntrySchema)),
  366. total: z.number().int(),
  367. });
  368. export type GeoEntryPage = z.infer<typeof GeoEntryPageSchema>;
  369. export const GeoFileSchema = z.object({
  370. categories: z.number().int(),
  371. error: z.string().optional(),
  372. kind: z.lazy(() => GeoKindSchema),
  373. modifiedAt: z.number().int(),
  374. name: z.string(),
  375. size: z.number().int(),
  376. });
  377. export type GeoFile = z.infer<typeof GeoFileSchema>;
  378. export const GeodataTokenIssueSchema = z.object({
  379. code: z.string().optional(),
  380. file: z.string().optional(),
  381. reason: z.string(),
  382. token: z.string(),
  383. });
  384. export type GeodataTokenIssue = z.infer<typeof GeodataTokenIssueSchema>;
  385. export const HistoryOfSeedersSchema = z.object({
  386. id: z.number().int(),
  387. seederName: z.string(),
  388. });
  389. export type HistoryOfSeeders = z.infer<typeof HistoryOfSeedersSchema>;
  390. export const HostSchema = z.object({
  391. address: z.string(),
  392. allowInsecure: z.boolean(),
  393. alpn: z.array(z.string()),
  394. createdAt: z.number().int(),
  395. echConfigList: z.string(),
  396. excludeFromSubTypes: z.array(z.string()),
  397. finalMask: z.string(),
  398. fingerprint: z.string(),
  399. groupId: z.string(),
  400. hostHeader: z.string(),
  401. id: z.number().int(),
  402. inboundId: z.number().int(),
  403. isDisabled: z.boolean(),
  404. isHidden: z.boolean(),
  405. keepSniBlank: z.boolean(),
  406. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  407. mihomoX25519: z.boolean(),
  408. muxParams: z.unknown(),
  409. nodeGuids: z.array(z.string()).optional(),
  410. overrideSniFromAddress: z.boolean(),
  411. path: z.string(),
  412. pinnedPeerCertSha256: z.array(z.string()),
  413. port: z.number().int().min(0).max(65535),
  414. remark: z.string().max(256),
  415. security: z.enum(['same', 'tls', 'none', 'reality']),
  416. serverDescription: z.string().max(64),
  417. shuffleHost: z.boolean(),
  418. sni: z.string(),
  419. sockoptParams: z.unknown(),
  420. sortOrder: z.number().int(),
  421. tags: z.array(z.string()),
  422. updatedAt: z.number().int(),
  423. verifyPeerCertByName: z.string(),
  424. vlessRoute: z.string(),
  425. });
  426. export type Host = z.infer<typeof HostSchema>;
  427. export const HostGroupSchema = z.object({
  428. allowInsecure: z.boolean(),
  429. alpn: z.array(z.string()),
  430. echConfigList: z.string(),
  431. excludeFromSubTypes: z.array(z.string()),
  432. finalMask: z.string(),
  433. fingerprint: z.string(),
  434. groupId: z.string(),
  435. hostHeader: z.string(),
  436. hosts: z.array(z.string()),
  437. inboundIds: z.array(z.number().int()),
  438. isDisabled: z.boolean(),
  439. isHidden: z.boolean(),
  440. keepSniBlank: z.boolean(),
  441. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  442. mihomoX25519: z.boolean(),
  443. muxParams: z.string(),
  444. nodeGuids: z.array(z.string()),
  445. overrideSniFromAddress: z.boolean(),
  446. path: z.string(),
  447. pinnedPeerCertSha256: z.array(z.string()),
  448. port: z.number().int().min(0).max(65535),
  449. remark: z.string().max(256),
  450. security: z.enum(['same', 'tls', 'none', 'reality']),
  451. serverDescription: z.string().max(64),
  452. shuffleHost: z.boolean(),
  453. sni: z.string(),
  454. sockoptParams: z.string(),
  455. sortOrder: z.number().int(),
  456. tags: z.array(z.string()),
  457. verifyPeerCertByName: z.string(),
  458. vlessRoute: z.string(),
  459. });
  460. export type HostGroup = z.infer<typeof HostGroupSchema>;
  461. export const InboundSchema = z.object({
  462. clientStats: z.array(z.lazy(() => ClientTrafficSchema)),
  463. down: z.number().int(),
  464. enable: z.boolean(),
  465. expiryTime: z.number().int(),
  466. fallbackParent: z.lazy(() => FallbackParentInfoSchema).nullable().optional(),
  467. id: z.number().int(),
  468. lastTrafficResetTime: z.number().int(),
  469. listen: z.string(),
  470. nodeId: z.number().int().nullable().optional(),
  471. originNodeGuid: z.string().optional(),
  472. port: z.number().int().min(0).max(65535),
  473. protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'http', 'mixed', 'tunnel', 'tun', 'mtproto']),
  474. remark: z.string(),
  475. settings: z.unknown(),
  476. shareAddr: z.string(),
  477. shareAddrStrategy: z.enum(['node', 'listen', 'custom']),
  478. sniffing: z.unknown(),
  479. streamSettings: z.unknown(),
  480. subSortIndex: z.number().int().min(1),
  481. tag: z.string(),
  482. total: z.number().int(),
  483. trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']),
  484. trafficResetDay: z.number().int().min(1).max(31),
  485. up: z.number().int(),
  486. });
  487. export type Inbound = z.infer<typeof InboundSchema>;
  488. export const InboundClientIpsSchema = z.object({
  489. clientEmail: z.string(),
  490. id: z.number().int(),
  491. ips: z.unknown(),
  492. });
  493. export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
  494. export const InboundFallbackSchema = z.object({
  495. alpn: z.string(),
  496. childId: z.number().int(),
  497. dest: z.string(),
  498. id: z.number().int(),
  499. masterId: z.number().int(),
  500. name: z.string(),
  501. path: z.string(),
  502. sortOrder: z.number().int(),
  503. xver: z.number().int(),
  504. });
  505. export type InboundFallback = z.infer<typeof InboundFallbackSchema>;
  506. export const InboundOptionSchema = z.object({
  507. enable: z.boolean(),
  508. id: z.number().int(),
  509. listen: z.string().optional(),
  510. mtprotoDomain: z.string().optional(),
  511. nodeAddress: z.string().optional(),
  512. nodeId: z.number().int().nullable().optional(),
  513. port: z.number().int(),
  514. protocol: z.string(),
  515. remark: z.string(),
  516. shareAddr: z.string().optional(),
  517. shareAddrStrategy: z.string().optional(),
  518. ssMethod: z.string(),
  519. tag: z.string(),
  520. tlsFlowCapable: z.boolean(),
  521. wgDns: z.string().optional(),
  522. wgMtu: z.number().int().optional(),
  523. wgPublicKey: z.string().optional(),
  524. });
  525. export type InboundOption = z.infer<typeof InboundOptionSchema>;
  526. export const MsgSchema = z.object({
  527. msg: z.string(),
  528. obj: z.unknown(),
  529. success: z.boolean(),
  530. });
  531. export type Msg = z.infer<typeof MsgSchema>;
  532. export const NodeSchema = z.object({
  533. activeCount: z.number().int(),
  534. address: z.string(),
  535. allowPrivateAddress: z.boolean(),
  536. basePath: z.string(),
  537. clientCount: z.number().int(),
  538. configDirty: z.boolean(),
  539. configDirtyAt: z.number().int(),
  540. cpuPct: z.number(),
  541. createdAt: z.number().int(),
  542. depletedCount: z.number().int(),
  543. disabledCount: z.number().int(),
  544. enable: z.boolean(),
  545. guid: z.string(),
  546. id: z.number().int(),
  547. inboundCount: z.number().int(),
  548. inboundSyncMode: z.enum(['all', 'selected']),
  549. inboundTags: z.array(z.string()),
  550. lastError: z.string(),
  551. lastHeartbeat: z.number().int(),
  552. latencyMs: z.number().int(),
  553. memPct: z.number(),
  554. name: z.string(),
  555. netDown: z.number().int(),
  556. netUp: z.number().int(),
  557. onlineCount: z.number().int(),
  558. outboundTag: z.string(),
  559. panelVersion: z.string(),
  560. parentGuid: z.string().optional(),
  561. pinnedCertSha256: z.string(),
  562. port: z.number().int().min(1).max(65535),
  563. remark: z.string(),
  564. scheme: z.enum(['http', 'https']),
  565. status: z.string(),
  566. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  567. transitive: z.boolean().optional(),
  568. updatedAt: z.number().int(),
  569. uptimeSecs: z.number().int(),
  570. xrayError: z.string(),
  571. xrayState: z.string(),
  572. xrayVersion: z.string(),
  573. });
  574. export type Node = z.infer<typeof NodeSchema>;
  575. export const NodeMutationRequestSchema = z.object({
  576. address: z.string(),
  577. allowPrivateAddress: z.boolean(),
  578. apiToken: z.string().nullable().optional(),
  579. basePath: z.string(),
  580. clearApiToken: z.boolean().optional(),
  581. enable: z.boolean(),
  582. id: z.number().int(),
  583. inboundSyncMode: z.enum(['all', 'selected']),
  584. inboundTags: z.array(z.string()),
  585. name: z.string(),
  586. outboundTag: z.string(),
  587. pinnedCertSha256: z.string(),
  588. port: z.number().int().min(1).max(65535),
  589. remark: z.string(),
  590. scheme: z.enum(['http', 'https']),
  591. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  592. });
  593. export type NodeMutationRequest = z.infer<typeof NodeMutationRequestSchema>;
  594. export const NodeViewSchema = z.object({
  595. activeCount: z.number().int(),
  596. address: z.string(),
  597. allowPrivateAddress: z.boolean(),
  598. basePath: z.string(),
  599. clientCount: z.number().int(),
  600. configDirty: z.boolean(),
  601. configDirtyAt: z.number().int(),
  602. cpuPct: z.number(),
  603. createdAt: z.number().int(),
  604. depletedCount: z.number().int(),
  605. disabledCount: z.number().int(),
  606. enable: z.boolean(),
  607. guid: z.string(),
  608. hasApiToken: z.boolean(),
  609. id: z.number().int(),
  610. inboundCount: z.number().int(),
  611. inboundSyncMode: z.string(),
  612. inboundTags: z.array(z.string()),
  613. lastError: z.string(),
  614. lastHeartbeat: z.number().int(),
  615. latencyMs: z.number().int(),
  616. memPct: z.number(),
  617. name: z.string(),
  618. netDown: z.number().int(),
  619. netUp: z.number().int(),
  620. onlineCount: z.number().int(),
  621. outboundTag: z.string(),
  622. panelVersion: z.string(),
  623. parentGuid: z.string().optional(),
  624. pinnedCertSha256: z.string(),
  625. port: z.number().int(),
  626. remark: z.string(),
  627. scheme: z.string(),
  628. status: z.string(),
  629. tlsVerifyMode: z.string(),
  630. transitive: z.boolean().optional(),
  631. updatedAt: z.number().int(),
  632. uptimeSecs: z.number().int(),
  633. xrayError: z.string(),
  634. xrayState: z.string(),
  635. xrayVersion: z.string(),
  636. });
  637. export type NodeView = z.infer<typeof NodeViewSchema>;
  638. export const OutboundTrafficsSchema = z.object({
  639. down: z.number().int(),
  640. id: z.number().int(),
  641. tag: z.string(),
  642. total: z.number().int(),
  643. up: z.number().int(),
  644. });
  645. export type OutboundTraffics = z.infer<typeof OutboundTrafficsSchema>;
  646. export const PanelUpdateStatusSchema = z.object({
  647. exitCode: z.number().int(),
  648. finishedAt: z.number().int(),
  649. runId: z.string(),
  650. state: z.string(),
  651. });
  652. export type PanelUpdateStatus = z.infer<typeof PanelUpdateStatusSchema>;
  653. export const ProbeResultUISchema = z.object({
  654. cpuPct: z.number(),
  655. error: z.string(),
  656. latencyMs: z.number().int(),
  657. memPct: z.number(),
  658. panelVersion: z.string(),
  659. status: z.string(),
  660. uptimeSecs: z.number().int(),
  661. xrayError: z.string(),
  662. xrayState: z.string(),
  663. xrayVersion: z.string(),
  664. });
  665. export type ProbeResultUI = z.infer<typeof ProbeResultUISchema>;
  666. export const RealityScanResultSchema = z.object({
  667. alpn: z.string(),
  668. certIssuer: z.string(),
  669. certSubject: z.string(),
  670. certValid: z.boolean(),
  671. curveID: z.string(),
  672. feasible: z.boolean(),
  673. h2: z.boolean(),
  674. host: z.string(),
  675. ip: z.string(),
  676. latencyMs: z.number().int(),
  677. notAfter: z.string(),
  678. port: z.number().int(),
  679. reason: z.string(),
  680. serverNames: z.array(z.string()),
  681. target: z.string(),
  682. tls13: z.boolean(),
  683. tlsVersion: z.string(),
  684. x25519: z.boolean(),
  685. });
  686. export type RealityScanResult = z.infer<typeof RealityScanResultSchema>;
  687. export const SettingSchema = z.object({
  688. id: z.number().int(),
  689. key: z.string(),
  690. value: z.string(),
  691. });
  692. export type Setting = z.infer<typeof SettingSchema>;
  693. export const UserSchema = z.object({
  694. id: z.number().int(),
  695. password: z.string(),
  696. username: z.string(),
  697. });
  698. export type User = z.infer<typeof UserSchema>;