zod.ts 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  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. ipLimitAllowlist: z.string(),
  25. ldapAutoCreate: z.boolean(),
  26. ldapAutoDelete: z.boolean(),
  27. ldapBaseDN: z.string(),
  28. ldapBindDN: z.string(),
  29. ldapDefaultExpiryDays: z.number().int().min(0),
  30. ldapDefaultLimitIP: z.number().int().min(0),
  31. ldapDefaultTotalGB: z.number().int().min(0),
  32. ldapEnable: z.boolean(),
  33. ldapFlagField: z.string(),
  34. ldapHost: z.string(),
  35. ldapInboundTags: z.string(),
  36. ldapInsecureSkipVerify: z.boolean(),
  37. ldapInvertFlag: z.boolean(),
  38. ldapPassword: z.string(),
  39. ldapPort: z.number().int().min(0).max(65535),
  40. ldapSyncCron: z.string(),
  41. ldapTruthyValues: z.string(),
  42. ldapUseTLS: z.boolean(),
  43. ldapUserAttr: z.string(),
  44. ldapUserFilter: z.string(),
  45. ldapVlessField: z.string(),
  46. outboundDownThreshold: z.number().int().min(1).max(100),
  47. pageSize: z.number().int().min(0).max(1000),
  48. panelOutbound: z.string(),
  49. remarkTemplate: z.string(),
  50. restartXrayOnClientDisable: z.boolean(),
  51. sessionMaxAge: z.number().int().min(1).max(525600),
  52. smtpCpu: z.number().int().min(0).max(100),
  53. smtpEnable: z.boolean(),
  54. smtpEnabledEvents: z.string(),
  55. smtpEncryptionType: z.string(),
  56. smtpFrom: z.string(),
  57. smtpFromName: z.string(),
  58. smtpHost: z.string(),
  59. smtpMemory: z.number().int().min(0).max(100),
  60. smtpPassword: z.string(),
  61. smtpPort: z.number().int().min(1).max(65535),
  62. smtpTo: z.string(),
  63. smtpUsername: z.string(),
  64. subAnnounce: z.string(),
  65. subCertFile: z.string(),
  66. subClashAutoDetect: z.boolean(),
  67. subClashEnable: z.boolean(),
  68. subClashEnableRouting: z.boolean(),
  69. subClashPath: z.string(),
  70. subClashRules: z.string(),
  71. subClashURI: z.string(),
  72. subClashUserAgentRegex: z.string(),
  73. subDomain: z.string(),
  74. subEnable: z.boolean(),
  75. subEnableRouting: z.boolean(),
  76. subEncrypt: z.boolean(),
  77. subExpiredTemplate: z.string(),
  78. subHideSettings: z.boolean(),
  79. subIncyEnableRouting: z.boolean(),
  80. subIncyRoutingRules: z.string(),
  81. subInfoNodeEnable: z.boolean(),
  82. subJsonAlwaysArray: z.boolean(),
  83. subJsonAutoDetect: z.boolean(),
  84. subJsonEnable: z.boolean(),
  85. subJsonFinalMask: z.string(),
  86. subJsonMux: z.string(),
  87. subJsonObservatory: z.string(),
  88. subJsonPath: z.string(),
  89. subJsonRules: z.string(),
  90. subJsonURI: z.string(),
  91. subJsonUserAgentRegex: z.string(),
  92. subKeyFile: z.string(),
  93. subListen: z.string(),
  94. subPath: z.string(),
  95. subPort: z.number().int().min(1).max(65535),
  96. subProfileUrl: z.string(),
  97. subRoutingRules: z.string(),
  98. subShowIdentityOnAllLinks: z.boolean(),
  99. subSupportUrl: z.string(),
  100. subThemeDir: z.string(),
  101. subTitle: z.string(),
  102. subTrafficDepletedTemplate: z.string(),
  103. subURI: z.string(),
  104. subUpdates: z.number().int().min(0).max(525600),
  105. tgBotAPIServer: z.string(),
  106. tgBotBackup: z.boolean(),
  107. tgBotChatId: z.string(),
  108. tgBotEnable: z.boolean(),
  109. tgBotProxy: z.string(),
  110. tgBotToken: z.string(),
  111. tgCpu: z.number().int().min(0).max(100),
  112. tgEnabledEvents: z.string(),
  113. tgLang: z.string(),
  114. tgMemory: z.number().int().min(0).max(100),
  115. tgRunTime: z.string(),
  116. timeLocation: z.string(),
  117. trafficDiff: z.number().int().min(0).max(100),
  118. trustedProxyCIDRs: z.string(),
  119. twoFactorEnable: z.boolean(),
  120. twoFactorToken: z.string(),
  121. warpUpdateInterval: z.number().int().min(0),
  122. webBasePath: z.string(),
  123. webCertFile: z.string(),
  124. webDomain: z.string(),
  125. webKeyFile: z.string(),
  126. webListen: z.string(),
  127. webPort: z.number().int().min(1).max(65535),
  128. });
  129. export type AllSetting = z.infer<typeof AllSettingSchema>;
  130. export const AllSettingViewSchema = z.object({
  131. datepicker: z.string(),
  132. expireDiff: z.number().int().min(0),
  133. externalTrafficInformEnable: z.boolean(),
  134. externalTrafficInformURI: z.string(),
  135. hasApiToken: z.boolean(),
  136. hasLdapPassword: z.boolean(),
  137. hasNordSecret: z.boolean(),
  138. hasSmtpPassword: z.boolean(),
  139. hasTgBotToken: z.boolean(),
  140. hasTwoFactorToken: z.boolean(),
  141. hasWarpSecret: z.boolean(),
  142. ipLimitAllowlist: z.string(),
  143. ldapAutoCreate: z.boolean(),
  144. ldapAutoDelete: z.boolean(),
  145. ldapBaseDN: z.string(),
  146. ldapBindDN: z.string(),
  147. ldapDefaultExpiryDays: z.number().int().min(0),
  148. ldapDefaultLimitIP: z.number().int().min(0),
  149. ldapDefaultTotalGB: z.number().int().min(0),
  150. ldapEnable: z.boolean(),
  151. ldapFlagField: z.string(),
  152. ldapHost: z.string(),
  153. ldapInboundTags: z.string(),
  154. ldapInsecureSkipVerify: z.boolean(),
  155. ldapInvertFlag: z.boolean(),
  156. ldapPassword: z.string(),
  157. ldapPort: z.number().int().min(0).max(65535),
  158. ldapSyncCron: z.string(),
  159. ldapTruthyValues: z.string(),
  160. ldapUseTLS: z.boolean(),
  161. ldapUserAttr: z.string(),
  162. ldapUserFilter: z.string(),
  163. ldapVlessField: z.string(),
  164. outboundDownThreshold: z.number().int().min(1).max(100),
  165. pageSize: z.number().int().min(0).max(1000),
  166. panelOutbound: z.string(),
  167. remarkTemplate: z.string(),
  168. restartXrayOnClientDisable: z.boolean(),
  169. sessionMaxAge: z.number().int().min(1).max(525600),
  170. smtpCpu: z.number().int().min(0).max(100),
  171. smtpEnable: z.boolean(),
  172. smtpEnabledEvents: z.string(),
  173. smtpEncryptionType: z.string(),
  174. smtpFrom: z.string(),
  175. smtpFromName: z.string(),
  176. smtpHost: z.string(),
  177. smtpMemory: z.number().int().min(0).max(100),
  178. smtpPassword: z.string(),
  179. smtpPort: z.number().int().min(1).max(65535),
  180. smtpTo: z.string(),
  181. smtpUsername: z.string(),
  182. subAnnounce: z.string(),
  183. subCertFile: z.string(),
  184. subClashAutoDetect: z.boolean(),
  185. subClashEnable: z.boolean(),
  186. subClashEnableRouting: z.boolean(),
  187. subClashPath: z.string(),
  188. subClashRules: z.string(),
  189. subClashURI: z.string(),
  190. subClashUserAgentRegex: z.string(),
  191. subDomain: z.string(),
  192. subEnable: z.boolean(),
  193. subEnableRouting: z.boolean(),
  194. subEncrypt: z.boolean(),
  195. subExpiredTemplate: z.string(),
  196. subHideSettings: z.boolean(),
  197. subIncyEnableRouting: z.boolean(),
  198. subIncyRoutingRules: z.string(),
  199. subInfoNodeEnable: z.boolean(),
  200. subJsonAlwaysArray: z.boolean(),
  201. subJsonAutoDetect: z.boolean(),
  202. subJsonEnable: z.boolean(),
  203. subJsonFinalMask: z.string(),
  204. subJsonMux: z.string(),
  205. subJsonObservatory: z.string(),
  206. subJsonPath: z.string(),
  207. subJsonRules: z.string(),
  208. subJsonURI: z.string(),
  209. subJsonUserAgentRegex: z.string(),
  210. subKeyFile: z.string(),
  211. subListen: z.string(),
  212. subPath: z.string(),
  213. subPort: z.number().int().min(1).max(65535),
  214. subProfileUrl: z.string(),
  215. subRoutingRules: z.string(),
  216. subShowIdentityOnAllLinks: z.boolean(),
  217. subSupportUrl: z.string(),
  218. subThemeDir: z.string(),
  219. subTitle: z.string(),
  220. subTrafficDepletedTemplate: z.string(),
  221. subURI: z.string(),
  222. subUpdates: z.number().int().min(0).max(525600),
  223. tgBotAPIServer: z.string(),
  224. tgBotBackup: z.boolean(),
  225. tgBotChatId: z.string(),
  226. tgBotEnable: z.boolean(),
  227. tgBotProxy: z.string(),
  228. tgBotToken: z.string(),
  229. tgCpu: z.number().int().min(0).max(100),
  230. tgEnabledEvents: z.string(),
  231. tgLang: z.string(),
  232. tgMemory: z.number().int().min(0).max(100),
  233. tgRunTime: z.string(),
  234. timeLocation: z.string(),
  235. trafficDiff: z.number().int().min(0).max(100),
  236. trustedProxyCIDRs: z.string(),
  237. twoFactorEnable: z.boolean(),
  238. twoFactorToken: z.string(),
  239. warpUpdateInterval: z.number().int().min(0),
  240. webBasePath: z.string(),
  241. webCertFile: z.string(),
  242. webDomain: z.string(),
  243. webKeyFile: z.string(),
  244. webListen: z.string(),
  245. webPort: z.number().int().min(1).max(65535),
  246. });
  247. export type AllSettingView = z.infer<typeof AllSettingViewSchema>;
  248. export const AmneziaWGLogsSchema = z.object({
  249. events: z.array(z.string()),
  250. peers: z.array(z.lazy(() => PeerActivitySchema)),
  251. running: z.boolean(),
  252. });
  253. export type AmneziaWGLogs = z.infer<typeof AmneziaWGLogsSchema>;
  254. export const ApiTokenSchema = z.object({
  255. createdAt: z.number().int(),
  256. enabled: z.boolean(),
  257. expiresAt: z.number().int(),
  258. id: z.number().int(),
  259. name: z.string(),
  260. scope: z.string(),
  261. token: z.string(),
  262. });
  263. export type ApiToken = z.infer<typeof ApiTokenSchema>;
  264. export const ApiTokenViewSchema = z.object({
  265. createdAt: z.number().int(),
  266. enabled: z.boolean(),
  267. expiresAt: z.number().int(),
  268. id: z.number().int(),
  269. name: z.string(),
  270. scope: z.string(),
  271. token: z.string().optional(),
  272. });
  273. export type ApiTokenView = z.infer<typeof ApiTokenViewSchema>;
  274. export const ClientSchema = z.object({
  275. adTag: z.string().optional(),
  276. allowedIPs: z.array(z.string()).optional(),
  277. allowedIPsByInbound: z.record(z.number().int(), z.array(z.string())).optional(),
  278. auth: z.string().optional(),
  279. comment: z.string(),
  280. created_at: z.number().int().optional(),
  281. email: z.string(),
  282. enable: z.boolean(),
  283. expiryTime: z.number().int(),
  284. flow: z.string().optional(),
  285. forwardedPorts: z.string().optional(),
  286. group: z.string().optional(),
  287. id: z.string().optional(),
  288. keepAlive: z.number().int().optional(),
  289. limitIp: z.number().int(),
  290. password: z.string().optional(),
  291. preSharedKey: z.string().optional(),
  292. privateKey: z.string().optional(),
  293. publicKey: z.string().optional(),
  294. reset: z.number().int(),
  295. resetDay: z.number().int(),
  296. resetMax: z.number().int(),
  297. reverse: z.lazy(() => ClientReverseSchema).nullable().optional(),
  298. secret: z.string().optional(),
  299. security: z.string(),
  300. subId: z.string(),
  301. tgId: z.number().int(),
  302. totalGB: z.number().int(),
  303. trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']).optional(),
  304. trafficResetDay: z.number().int().min(1).max(31).optional(),
  305. updated_at: z.number().int().optional(),
  306. });
  307. export type Client = z.infer<typeof ClientSchema>;
  308. export const ClientInboundSchema = z.object({
  309. clientId: z.number().int(),
  310. createdAt: z.number().int(),
  311. flowOverride: z.string(),
  312. inboundId: z.number().int(),
  313. });
  314. export type ClientInbound = z.infer<typeof ClientInboundSchema>;
  315. export const ClientPageResponseSchema = z.object({
  316. filtered: z.number().int(),
  317. groups: z.array(z.string()),
  318. items: z.array(z.lazy(() => ClientSlimSchema)),
  319. page: z.number().int(),
  320. pageSize: z.number().int(),
  321. summary: z.lazy(() => ClientsSummarySchema),
  322. total: z.number().int(),
  323. });
  324. export type ClientPageResponse = z.infer<typeof ClientPageResponseSchema>;
  325. export const ClientRecordSchema = z.object({
  326. adTag: z.string(),
  327. allowedIPs: z.string(),
  328. auth: z.string(),
  329. comment: z.string(),
  330. createdAt: z.number().int(),
  331. email: z.string(),
  332. enable: z.boolean(),
  333. expiryTime: z.number().int(),
  334. flow: z.string(),
  335. forwardedPorts: z.string(),
  336. group: z.string(),
  337. id: z.number().int(),
  338. keepAlive: z.number().int(),
  339. limitHwid: z.number().int(),
  340. limitIp: z.number().int(),
  341. password: z.string(),
  342. preSharedKey: z.string(),
  343. privateKey: z.string(),
  344. publicKey: z.string(),
  345. reset: z.number().int(),
  346. resetDay: z.number().int(),
  347. resetMax: z.number().int(),
  348. reverse: z.unknown(),
  349. secret: z.string(),
  350. security: z.string(),
  351. subId: z.string(),
  352. tgId: z.number().int(),
  353. totalGB: z.number().int(),
  354. trafficReset: z.string(),
  355. trafficResetDay: z.number().int(),
  356. updatedAt: z.number().int(),
  357. uuid: z.string(),
  358. });
  359. export type ClientRecord = z.infer<typeof ClientRecordSchema>;
  360. export const ClientReverseSchema = z.object({
  361. tag: z.string(),
  362. });
  363. export type ClientReverse = z.infer<typeof ClientReverseSchema>;
  364. export const ClientSlimSchema = z.object({
  365. comment: z.string().optional(),
  366. createdAt: z.number().int(),
  367. email: z.string(),
  368. enable: z.boolean(),
  369. expiryTime: z.number().int(),
  370. group: z.string().optional(),
  371. inboundIds: z.array(z.number().int()),
  372. limitHwid: z.number().int(),
  373. limitIp: z.number().int(),
  374. reset: z.number().int(),
  375. resetDay: z.number().int(),
  376. resetMax: z.number().int(),
  377. subId: z.string(),
  378. totalGB: z.number().int(),
  379. traffic: z.lazy(() => ClientTrafficSchema).nullable().optional(),
  380. updatedAt: z.number().int(),
  381. });
  382. export type ClientSlim = z.infer<typeof ClientSlimSchema>;
  383. export const ClientTrafficSchema = z.object({
  384. down: z.number().int(),
  385. email: z.string(),
  386. enable: z.boolean(),
  387. expiryTime: z.number().int(),
  388. id: z.number().int(),
  389. inboundId: z.number().int(),
  390. lastOnline: z.number().int(),
  391. lastSubFetch: z.number().int(),
  392. reset: z.number().int(),
  393. resetCount: z.number().int(),
  394. resetDay: z.number().int(),
  395. resetMax: z.number().int(),
  396. subId: z.string(),
  397. total: z.number().int(),
  398. up: z.number().int(),
  399. uuid: z.string(),
  400. });
  401. export type ClientTraffic = z.infer<typeof ClientTrafficSchema>;
  402. export const ClientsSummarySchema = z.object({
  403. active: z.number().int(),
  404. deactive: z.array(z.string()),
  405. deactiveCount: z.number().int(),
  406. depleted: z.array(z.string()),
  407. depletedCount: z.number().int(),
  408. expiring: z.array(z.string()),
  409. expiringCount: z.number().int(),
  410. online: z.array(z.string()),
  411. onlineCount: z.number().int(),
  412. total: z.number().int(),
  413. });
  414. export type ClientsSummary = z.infer<typeof ClientsSummarySchema>;
  415. export const FallbackParentInfoSchema = z.object({
  416. masterId: z.number().int(),
  417. path: z.string().optional(),
  418. });
  419. export type FallbackParentInfo = z.infer<typeof FallbackParentInfoSchema>;
  420. export const GeoCategorySchema = z.object({
  421. attributes: z.array(z.string()),
  422. code: z.string(),
  423. entries: z.number().int(),
  424. });
  425. export type GeoCategory = z.infer<typeof GeoCategorySchema>;
  426. export const GeoCategoryPageSchema = z.object({
  427. items: z.array(z.lazy(() => GeoCategorySchema)),
  428. total: z.number().int(),
  429. });
  430. export type GeoCategoryPage = z.infer<typeof GeoCategoryPageSchema>;
  431. export const GeoEntrySchema = z.object({
  432. kind: z.string(),
  433. value: z.string(),
  434. });
  435. export type GeoEntry = z.infer<typeof GeoEntrySchema>;
  436. export const GeoEntryPageSchema = z.object({
  437. items: z.array(z.lazy(() => GeoEntrySchema)),
  438. total: z.number().int(),
  439. });
  440. export type GeoEntryPage = z.infer<typeof GeoEntryPageSchema>;
  441. export const GeoFileSchema = z.object({
  442. categories: z.number().int(),
  443. error: z.string().optional(),
  444. kind: z.lazy(() => GeoKindSchema),
  445. modifiedAt: z.number().int(),
  446. name: z.string(),
  447. size: z.number().int(),
  448. });
  449. export type GeoFile = z.infer<typeof GeoFileSchema>;
  450. export const GeodataTokenIssueSchema = z.object({
  451. code: z.string().optional(),
  452. file: z.string().optional(),
  453. reason: z.string(),
  454. token: z.string(),
  455. });
  456. export type GeodataTokenIssue = z.infer<typeof GeodataTokenIssueSchema>;
  457. export const HistoryOfSeedersSchema = z.object({
  458. id: z.number().int(),
  459. seederName: z.string(),
  460. });
  461. export type HistoryOfSeeders = z.infer<typeof HistoryOfSeedersSchema>;
  462. export const HostSchema = z.object({
  463. address: z.string(),
  464. allowInsecure: z.boolean(),
  465. alpn: z.array(z.string()),
  466. createdAt: z.number().int(),
  467. echConfigList: z.string(),
  468. excludeFromSubTypes: z.array(z.string()),
  469. finalMask: z.string(),
  470. fingerprint: z.string(),
  471. groupId: z.string(),
  472. hostHeader: z.string(),
  473. id: z.number().int(),
  474. inboundId: z.number().int(),
  475. isDisabled: z.boolean(),
  476. isHidden: z.boolean(),
  477. keepSniBlank: z.boolean(),
  478. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  479. mihomoX25519: z.boolean(),
  480. muxParams: z.unknown(),
  481. nodeGuids: z.array(z.string()).optional(),
  482. overrideSniFromAddress: z.boolean(),
  483. path: z.string(),
  484. pinnedPeerCertSha256: z.array(z.string()),
  485. port: z.number().int().min(0).max(65535),
  486. remark: z.string().max(256),
  487. security: z.enum(['same', 'tls', 'none', 'reality']),
  488. serverDescription: z.string().max(64),
  489. shuffleHost: z.boolean(),
  490. sni: z.string(),
  491. sockoptParams: z.unknown(),
  492. sortOrder: z.number().int(),
  493. tags: z.array(z.string()),
  494. updatedAt: z.number().int(),
  495. verifyPeerCertByName: z.string(),
  496. vlessRoute: z.string(),
  497. });
  498. export type Host = z.infer<typeof HostSchema>;
  499. export const HostGroupSchema = z.object({
  500. allowInsecure: z.boolean(),
  501. alpn: z.array(z.string()),
  502. echConfigList: z.string(),
  503. excludeFromSubTypes: z.array(z.string()),
  504. finalMask: z.string(),
  505. fingerprint: z.string(),
  506. groupId: z.string(),
  507. hostHeader: z.string(),
  508. hosts: z.array(z.string()),
  509. inboundIds: z.array(z.number().int()),
  510. isDisabled: z.boolean(),
  511. isHidden: z.boolean(),
  512. keepSniBlank: z.boolean(),
  513. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  514. mihomoX25519: z.boolean(),
  515. muxParams: z.string(),
  516. nodeGuids: z.array(z.string()),
  517. overrideSniFromAddress: z.boolean(),
  518. path: z.string(),
  519. pinnedPeerCertSha256: z.array(z.string()),
  520. port: z.number().int().min(0).max(65535),
  521. remark: z.string().max(256),
  522. security: z.enum(['same', 'tls', 'none', 'reality']),
  523. serverDescription: z.string().max(64),
  524. shuffleHost: z.boolean(),
  525. sni: z.string(),
  526. sockoptParams: z.string(),
  527. sortOrder: z.number().int(),
  528. tags: z.array(z.string()),
  529. verifyPeerCertByName: z.string(),
  530. vlessRoute: z.string(),
  531. });
  532. export type HostGroup = z.infer<typeof HostGroupSchema>;
  533. export const InboundSchema = z.object({
  534. clientStats: z.array(z.lazy(() => ClientTrafficSchema)),
  535. disableFlow: z.boolean(),
  536. down: z.number().int(),
  537. enable: z.boolean(),
  538. expiryTime: z.number().int(),
  539. fallbackParent: z.lazy(() => FallbackParentInfoSchema).nullable().optional(),
  540. id: z.number().int(),
  541. lastTrafficResetTime: z.number().int(),
  542. listen: z.string(),
  543. nodeId: z.number().int().nullable().optional(),
  544. originNodeGuid: z.string().optional(),
  545. port: z.number().int().min(0).max(65535),
  546. protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'http', 'mixed', 'tunnel', 'tun', 'mtproto', 'amneziawg']),
  547. remark: z.string(),
  548. settings: z.unknown(),
  549. shareAddr: z.string(),
  550. shareAddrStrategy: z.enum(['node', 'listen', 'custom']),
  551. sniffing: z.unknown(),
  552. streamSettings: z.unknown(),
  553. subSortIndex: z.number().int().min(1),
  554. tag: z.string(),
  555. total: z.number().int(),
  556. trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']),
  557. trafficResetDay: z.number().int().min(1).max(31),
  558. up: z.number().int(),
  559. });
  560. export type Inbound = z.infer<typeof InboundSchema>;
  561. export const InboundClientIpsSchema = z.object({
  562. clientEmail: z.string(),
  563. id: z.number().int(),
  564. ips: z.unknown(),
  565. });
  566. export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
  567. export const InboundFallbackSchema = z.object({
  568. alpn: z.string(),
  569. childId: z.number().int(),
  570. dest: z.string(),
  571. id: z.number().int(),
  572. masterId: z.number().int(),
  573. name: z.string(),
  574. path: z.string(),
  575. sortOrder: z.number().int(),
  576. xver: z.number().int(),
  577. });
  578. export type InboundFallback = z.infer<typeof InboundFallbackSchema>;
  579. export const InboundOptionSchema = z.object({
  580. awgServer: z.lazy(() => ServerSettingsSchema).nullable().optional(),
  581. enable: z.boolean(),
  582. id: z.number().int(),
  583. listen: z.string().optional(),
  584. mtprotoDomain: z.string().optional(),
  585. nodeAddress: z.string().optional(),
  586. nodeId: z.number().int().nullable().optional(),
  587. port: z.number().int(),
  588. protocol: z.string(),
  589. remark: z.string(),
  590. shareAddr: z.string().optional(),
  591. shareAddrStrategy: z.string().optional(),
  592. ssMethod: z.string(),
  593. tag: z.string(),
  594. tlsFlowCapable: z.boolean(),
  595. wgDns: z.string().optional(),
  596. wgMtu: z.number().int().optional(),
  597. wgPublicKey: z.string().optional(),
  598. });
  599. export type InboundOption = z.infer<typeof InboundOptionSchema>;
  600. export const InboundTrafficSummarySchema = z.object({
  601. down: z.number().int(),
  602. enable: z.boolean(),
  603. id: z.number().int(),
  604. total: z.number().int(),
  605. up: z.number().int(),
  606. });
  607. export type InboundTrafficSummary = z.infer<typeof InboundTrafficSummarySchema>;
  608. export const LogEntrySchema = z.object({
  609. DateTime: z.string(),
  610. Email: z.string(),
  611. Event: z.number().int(),
  612. FromAddress: z.string(),
  613. Inbound: z.string(),
  614. Outbound: z.string(),
  615. ToAddress: z.string(),
  616. });
  617. export type LogEntry = z.infer<typeof LogEntrySchema>;
  618. export const MLDSA65ResponseSchema = z.object({
  619. seed: z.string(),
  620. verify: z.string(),
  621. });
  622. export type MLDSA65Response = z.infer<typeof MLDSA65ResponseSchema>;
  623. export const MLKEM768ResponseSchema = z.object({
  624. client: z.string(),
  625. seed: z.string(),
  626. });
  627. export type MLKEM768Response = z.infer<typeof MLKEM768ResponseSchema>;
  628. export const MsgSchema = z.object({
  629. msg: z.string(),
  630. obj: z.unknown(),
  631. success: z.boolean(),
  632. });
  633. export type Msg = z.infer<typeof MsgSchema>;
  634. export const NewUUIDResponseSchema = z.object({
  635. uuid: z.string(),
  636. });
  637. export type NewUUIDResponse = z.infer<typeof NewUUIDResponseSchema>;
  638. export const NodeSchema = z.object({
  639. activeCount: z.number().int(),
  640. address: z.string(),
  641. allowPrivateAddress: z.boolean(),
  642. basePath: z.string(),
  643. clientCount: z.number().int(),
  644. configDirty: z.boolean(),
  645. configDirtyAt: z.number().int(),
  646. cpuPct: z.number(),
  647. createdAt: z.number().int(),
  648. depletedCount: z.number().int(),
  649. disabledCount: z.number().int(),
  650. enable: z.boolean(),
  651. guid: z.string(),
  652. id: z.number().int(),
  653. inboundCount: z.number().int(),
  654. inboundSyncMode: z.enum(['all', 'selected']),
  655. inboundTags: z.array(z.string()),
  656. lastError: z.string(),
  657. lastHeartbeat: z.number().int(),
  658. latencyMs: z.number().int(),
  659. memPct: z.number(),
  660. name: z.string(),
  661. netDown: z.number().int(),
  662. netUp: z.number().int(),
  663. onlineCount: z.number().int(),
  664. outboundTag: z.string(),
  665. panelVersion: z.string(),
  666. parentGuid: z.string().optional(),
  667. pinnedCertSha256: z.string(),
  668. port: z.number().int().min(1).max(65535),
  669. remark: z.string(),
  670. scheme: z.enum(['http', 'https']),
  671. status: z.string(),
  672. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  673. transitive: z.boolean().optional(),
  674. updatedAt: z.number().int(),
  675. uptimeSecs: z.number().int(),
  676. xrayError: z.string(),
  677. xrayState: z.string(),
  678. xrayVersion: z.string(),
  679. });
  680. export type Node = z.infer<typeof NodeSchema>;
  681. export const NodeMutationRequestSchema = z.object({
  682. address: z.string(),
  683. allowPrivateAddress: z.boolean(),
  684. apiToken: z.string().nullable().optional(),
  685. basePath: z.string(),
  686. clearApiToken: z.boolean().optional(),
  687. enable: z.boolean(),
  688. id: z.number().int(),
  689. inboundSyncMode: z.enum(['all', 'selected']),
  690. inboundTags: z.array(z.string()),
  691. name: z.string(),
  692. outboundTag: z.string(),
  693. pinnedCertSha256: z.string(),
  694. port: z.number().int().min(1).max(65535),
  695. remark: z.string(),
  696. scheme: z.enum(['http', 'https']),
  697. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  698. });
  699. export type NodeMutationRequest = z.infer<typeof NodeMutationRequestSchema>;
  700. export const NodeViewSchema = z.object({
  701. activeCount: z.number().int(),
  702. address: z.string(),
  703. allowPrivateAddress: z.boolean(),
  704. basePath: z.string(),
  705. clientCount: z.number().int(),
  706. configDirty: z.boolean(),
  707. configDirtyAt: z.number().int(),
  708. cpuPct: z.number(),
  709. createdAt: z.number().int(),
  710. depletedCount: z.number().int(),
  711. disabledCount: z.number().int(),
  712. enable: z.boolean(),
  713. guid: z.string(),
  714. hasApiToken: z.boolean(),
  715. id: z.number().int(),
  716. inboundCount: z.number().int(),
  717. inboundSyncMode: z.string(),
  718. inboundTags: z.array(z.string()),
  719. lastError: z.string(),
  720. lastHeartbeat: z.number().int(),
  721. latencyMs: z.number().int(),
  722. memPct: z.number(),
  723. name: z.string(),
  724. netDown: z.number().int(),
  725. netUp: z.number().int(),
  726. onlineCount: z.number().int(),
  727. outboundTag: z.string(),
  728. panelVersion: z.string(),
  729. parentGuid: z.string().optional(),
  730. pinnedCertSha256: z.string(),
  731. port: z.number().int(),
  732. remark: z.string(),
  733. scheme: z.string(),
  734. status: z.string(),
  735. tlsVerifyMode: z.string(),
  736. transitive: z.boolean().optional(),
  737. updatedAt: z.number().int(),
  738. uptimeSecs: z.number().int(),
  739. xrayError: z.string(),
  740. xrayState: z.string(),
  741. xrayVersion: z.string(),
  742. });
  743. export type NodeView = z.infer<typeof NodeViewSchema>;
  744. export const OutboundTrafficsSchema = z.object({
  745. down: z.number().int(),
  746. id: z.number().int(),
  747. tag: z.string(),
  748. total: z.number().int(),
  749. up: z.number().int(),
  750. });
  751. export type OutboundTraffics = z.infer<typeof OutboundTrafficsSchema>;
  752. export const PanelUpdateStatusSchema = z.object({
  753. exitCode: z.number().int(),
  754. finishedAt: z.number().int(),
  755. runId: z.string(),
  756. state: z.string(),
  757. });
  758. export type PanelUpdateStatus = z.infer<typeof PanelUpdateStatusSchema>;
  759. export const PeerActivitySchema = z.object({
  760. allowedIPs: z.string(),
  761. down: z.number().int(),
  762. email: z.string(),
  763. endpoint: z.string(),
  764. handshake: z.number().int(),
  765. inboundId: z.number().int(),
  766. interface: z.string(),
  767. online: z.boolean(),
  768. tag: z.string(),
  769. up: z.number().int(),
  770. });
  771. export type PeerActivity = z.infer<typeof PeerActivitySchema>;
  772. export const ProbeResultUISchema = z.object({
  773. cpuPct: z.number(),
  774. error: z.string(),
  775. latencyMs: z.number().int(),
  776. memPct: z.number(),
  777. panelVersion: z.string(),
  778. status: z.string(),
  779. uptimeSecs: z.number().int(),
  780. xrayError: z.string(),
  781. xrayState: z.string(),
  782. xrayVersion: z.string(),
  783. });
  784. export type ProbeResultUI = z.infer<typeof ProbeResultUISchema>;
  785. export const RealityScanResultSchema = z.object({
  786. alpn: z.string(),
  787. certChainValid: z.boolean(),
  788. certIssuer: z.string(),
  789. certSubject: z.string(),
  790. certValid: z.boolean(),
  791. curveID: z.string(),
  792. feasible: z.boolean(),
  793. h2: z.boolean(),
  794. host: z.string(),
  795. ip: z.string(),
  796. latencyMs: z.number().int(),
  797. notAfter: z.string(),
  798. port: z.number().int(),
  799. privateTarget: z.boolean(),
  800. reason: z.string(),
  801. serverNames: z.array(z.string()),
  802. target: z.string(),
  803. tls13: z.boolean(),
  804. tlsVersion: z.string(),
  805. x25519: z.boolean(),
  806. });
  807. export type RealityScanResult = z.infer<typeof RealityScanResultSchema>;
  808. export const ServerSettingsSchema = z.object({
  809. contentPaddingAddition: z.string().optional(),
  810. disableCookies: z.boolean(),
  811. externalInterface: z.string().optional(),
  812. h1: z.string(),
  813. h2: z.string(),
  814. h3: z.string(),
  815. h4: z.string(),
  816. headerProtectionKey: z.string().optional(),
  817. i1: z.string().optional(),
  818. i2: z.string().optional(),
  819. i3: z.string().optional(),
  820. i4: z.string().optional(),
  821. i5: z.string().optional(),
  822. ipv6Enabled: z.boolean().optional(),
  823. ipv6ExternalInterface: z.string().optional(),
  824. ipv6Subnet: z.string().optional(),
  825. jc: z.number().int(),
  826. jmax: z.number().int(),
  827. jmin: z.number().int(),
  828. keepaliveTimeout: z.string().optional(),
  829. maxHandshakeAttempts: z.string().optional(),
  830. mtu: z.number().int().optional(),
  831. primaryDns: z.string(),
  832. privateKey: z.string(),
  833. publicKey: z.string(),
  834. randomTrailers: z.boolean(),
  835. rejectAfterTime: z.string().optional(),
  836. rekeyAfterTime: z.string().optional(),
  837. rekeyTimeout: z.string().optional(),
  838. routeThroughXray: z.boolean().optional(),
  839. s1: z.number().int(),
  840. s2: z.number().int(),
  841. s3: z.number().int(),
  842. s4: z.number().int(),
  843. secondaryDns: z.string(),
  844. subnetCidr: z.number().int(),
  845. subnetIp: z.string(),
  846. });
  847. export type ServerSettings = z.infer<typeof ServerSettingsSchema>;
  848. export const SettingSchema = z.object({
  849. id: z.number().int(),
  850. key: z.string(),
  851. value: z.string(),
  852. });
  853. export type Setting = z.infer<typeof SettingSchema>;
  854. export const SubBalancerSchema = z.object({
  855. createdAt: z.number().int(),
  856. enabled: z.boolean(),
  857. id: z.number().int(),
  858. inboundIds: z.array(z.number().int()),
  859. memberWeights: z.record(z.number().int(), z.number()).optional(),
  860. remark: z.string().max(256),
  861. sortOrder: z.number().int().min(1),
  862. strategy: z.enum(['leastLoad', 'leastPing', 'random', 'roundRobin']),
  863. updatedAt: z.number().int(),
  864. });
  865. export type SubBalancer = z.infer<typeof SubBalancerSchema>;
  866. export const TrafficSchema = z.object({
  867. Down: z.number().int(),
  868. IsInbound: z.boolean(),
  869. IsOutbound: z.boolean(),
  870. Tag: z.string(),
  871. Up: z.number().int(),
  872. });
  873. export type Traffic = z.infer<typeof TrafficSchema>;
  874. export const UserSchema = z.object({
  875. id: z.number().int(),
  876. password: z.string(),
  877. username: z.string(),
  878. });
  879. export type User = z.infer<typeof UserSchema>;