zod.ts 23 KB

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