zod.ts 23 KB

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