zod.ts 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  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 AmneziaWGLogsSchema = z.object({
  243. events: z.array(z.string()),
  244. peers: z.array(z.lazy(() => PeerActivitySchema)),
  245. running: z.boolean(),
  246. });
  247. export type AmneziaWGLogs = z.infer<typeof AmneziaWGLogsSchema>;
  248. export const ApiTokenSchema = z.object({
  249. createdAt: z.number().int(),
  250. enabled: z.boolean(),
  251. expiresAt: z.number().int(),
  252. id: z.number().int(),
  253. name: z.string(),
  254. scope: z.string(),
  255. token: z.string(),
  256. });
  257. export type ApiToken = z.infer<typeof ApiTokenSchema>;
  258. export const ApiTokenViewSchema = z.object({
  259. createdAt: z.number().int(),
  260. enabled: z.boolean(),
  261. expiresAt: z.number().int(),
  262. id: z.number().int(),
  263. name: z.string(),
  264. scope: z.string(),
  265. token: z.string().optional(),
  266. });
  267. export type ApiTokenView = z.infer<typeof ApiTokenViewSchema>;
  268. export const ClientSchema = z.object({
  269. adTag: z.string().optional(),
  270. allowedIPs: z.array(z.string()).optional(),
  271. allowedIPsByInbound: z.record(z.number().int(), z.array(z.string())).optional(),
  272. auth: z.string().optional(),
  273. comment: z.string(),
  274. created_at: z.number().int().optional(),
  275. email: z.string(),
  276. enable: z.boolean(),
  277. expiryTime: z.number().int(),
  278. flow: z.string().optional(),
  279. forwardedPorts: z.string().optional(),
  280. group: z.string().optional(),
  281. id: z.string().optional(),
  282. keepAlive: z.number().int().optional(),
  283. limitIp: z.number().int(),
  284. password: z.string().optional(),
  285. preSharedKey: z.string().optional(),
  286. privateKey: z.string().optional(),
  287. publicKey: z.string().optional(),
  288. reset: z.number().int(),
  289. resetDay: z.number().int(),
  290. resetMax: z.number().int(),
  291. reverse: z.lazy(() => ClientReverseSchema).nullable().optional(),
  292. secret: z.string().optional(),
  293. security: z.string(),
  294. subId: z.string(),
  295. tgId: z.number().int(),
  296. totalGB: z.number().int(),
  297. trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']).optional(),
  298. trafficResetDay: z.number().int().min(1).max(31).optional(),
  299. updated_at: z.number().int().optional(),
  300. });
  301. export type Client = z.infer<typeof ClientSchema>;
  302. export const ClientInboundSchema = z.object({
  303. clientId: z.number().int(),
  304. createdAt: z.number().int(),
  305. flowOverride: z.string(),
  306. inboundId: z.number().int(),
  307. });
  308. export type ClientInbound = z.infer<typeof ClientInboundSchema>;
  309. export const ClientRecordSchema = z.object({
  310. adTag: z.string(),
  311. allowedIPs: z.string(),
  312. auth: z.string(),
  313. comment: z.string(),
  314. createdAt: z.number().int(),
  315. email: z.string(),
  316. enable: z.boolean(),
  317. expiryTime: z.number().int(),
  318. flow: z.string(),
  319. forwardedPorts: z.string(),
  320. group: z.string(),
  321. id: z.number().int(),
  322. keepAlive: z.number().int(),
  323. limitHwid: z.number().int(),
  324. limitIp: z.number().int(),
  325. password: z.string(),
  326. preSharedKey: z.string(),
  327. privateKey: z.string(),
  328. publicKey: z.string(),
  329. reset: z.number().int(),
  330. resetDay: z.number().int(),
  331. resetMax: z.number().int(),
  332. reverse: z.unknown(),
  333. secret: z.string(),
  334. security: z.string(),
  335. subId: z.string(),
  336. tgId: z.number().int(),
  337. totalGB: z.number().int(),
  338. trafficReset: z.string(),
  339. trafficResetDay: z.number().int(),
  340. updatedAt: z.number().int(),
  341. uuid: z.string(),
  342. });
  343. export type ClientRecord = z.infer<typeof ClientRecordSchema>;
  344. export const ClientReverseSchema = z.object({
  345. tag: z.string(),
  346. });
  347. export type ClientReverse = z.infer<typeof ClientReverseSchema>;
  348. export const ClientTrafficSchema = z.object({
  349. down: z.number().int(),
  350. email: z.string(),
  351. enable: z.boolean(),
  352. expiryTime: z.number().int(),
  353. id: z.number().int(),
  354. inboundId: z.number().int(),
  355. lastOnline: z.number().int(),
  356. lastSubFetch: z.number().int(),
  357. reset: z.number().int(),
  358. resetCount: z.number().int(),
  359. resetDay: z.number().int(),
  360. resetMax: z.number().int(),
  361. subId: z.string(),
  362. total: z.number().int(),
  363. up: z.number().int(),
  364. uuid: z.string(),
  365. });
  366. export type ClientTraffic = z.infer<typeof ClientTrafficSchema>;
  367. export const FallbackParentInfoSchema = z.object({
  368. masterId: z.number().int(),
  369. path: z.string().optional(),
  370. });
  371. export type FallbackParentInfo = z.infer<typeof FallbackParentInfoSchema>;
  372. export const GeoCategorySchema = z.object({
  373. attributes: z.array(z.string()),
  374. code: z.string(),
  375. entries: z.number().int(),
  376. });
  377. export type GeoCategory = z.infer<typeof GeoCategorySchema>;
  378. export const GeoCategoryPageSchema = z.object({
  379. items: z.array(z.lazy(() => GeoCategorySchema)),
  380. total: z.number().int(),
  381. });
  382. export type GeoCategoryPage = z.infer<typeof GeoCategoryPageSchema>;
  383. export const GeoEntrySchema = z.object({
  384. kind: z.string(),
  385. value: z.string(),
  386. });
  387. export type GeoEntry = z.infer<typeof GeoEntrySchema>;
  388. export const GeoEntryPageSchema = z.object({
  389. items: z.array(z.lazy(() => GeoEntrySchema)),
  390. total: z.number().int(),
  391. });
  392. export type GeoEntryPage = z.infer<typeof GeoEntryPageSchema>;
  393. export const GeoFileSchema = z.object({
  394. categories: z.number().int(),
  395. error: z.string().optional(),
  396. kind: z.lazy(() => GeoKindSchema),
  397. modifiedAt: z.number().int(),
  398. name: z.string(),
  399. size: z.number().int(),
  400. });
  401. export type GeoFile = z.infer<typeof GeoFileSchema>;
  402. export const GeodataTokenIssueSchema = z.object({
  403. code: z.string().optional(),
  404. file: z.string().optional(),
  405. reason: z.string(),
  406. token: z.string(),
  407. });
  408. export type GeodataTokenIssue = z.infer<typeof GeodataTokenIssueSchema>;
  409. export const HistoryOfSeedersSchema = z.object({
  410. id: z.number().int(),
  411. seederName: z.string(),
  412. });
  413. export type HistoryOfSeeders = z.infer<typeof HistoryOfSeedersSchema>;
  414. export const HostSchema = z.object({
  415. address: z.string(),
  416. allowInsecure: z.boolean(),
  417. alpn: z.array(z.string()),
  418. createdAt: z.number().int(),
  419. echConfigList: z.string(),
  420. excludeFromSubTypes: z.array(z.string()),
  421. finalMask: z.string(),
  422. fingerprint: z.string(),
  423. groupId: z.string(),
  424. hostHeader: z.string(),
  425. id: z.number().int(),
  426. inboundId: z.number().int(),
  427. isDisabled: z.boolean(),
  428. isHidden: z.boolean(),
  429. keepSniBlank: z.boolean(),
  430. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  431. mihomoX25519: z.boolean(),
  432. muxParams: z.unknown(),
  433. nodeGuids: z.array(z.string()).optional(),
  434. overrideSniFromAddress: z.boolean(),
  435. path: z.string(),
  436. pinnedPeerCertSha256: z.array(z.string()),
  437. port: z.number().int().min(0).max(65535),
  438. remark: z.string().max(256),
  439. security: z.enum(['same', 'tls', 'none', 'reality']),
  440. serverDescription: z.string().max(64),
  441. shuffleHost: z.boolean(),
  442. sni: z.string(),
  443. sockoptParams: z.unknown(),
  444. sortOrder: z.number().int(),
  445. tags: z.array(z.string()),
  446. updatedAt: z.number().int(),
  447. verifyPeerCertByName: z.string(),
  448. vlessRoute: z.string(),
  449. });
  450. export type Host = z.infer<typeof HostSchema>;
  451. export const HostGroupSchema = z.object({
  452. allowInsecure: z.boolean(),
  453. alpn: z.array(z.string()),
  454. echConfigList: z.string(),
  455. excludeFromSubTypes: z.array(z.string()),
  456. finalMask: z.string(),
  457. fingerprint: z.string(),
  458. groupId: z.string(),
  459. hostHeader: z.string(),
  460. hosts: z.array(z.string()),
  461. inboundIds: z.array(z.number().int()),
  462. isDisabled: z.boolean(),
  463. isHidden: z.boolean(),
  464. keepSniBlank: z.boolean(),
  465. mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
  466. mihomoX25519: z.boolean(),
  467. muxParams: z.string(),
  468. nodeGuids: z.array(z.string()),
  469. overrideSniFromAddress: z.boolean(),
  470. path: z.string(),
  471. pinnedPeerCertSha256: z.array(z.string()),
  472. port: z.number().int().min(0).max(65535),
  473. remark: z.string().max(256),
  474. security: z.enum(['same', 'tls', 'none', 'reality']),
  475. serverDescription: z.string().max(64),
  476. shuffleHost: z.boolean(),
  477. sni: z.string(),
  478. sockoptParams: z.string(),
  479. sortOrder: z.number().int(),
  480. tags: z.array(z.string()),
  481. verifyPeerCertByName: z.string(),
  482. vlessRoute: z.string(),
  483. });
  484. export type HostGroup = z.infer<typeof HostGroupSchema>;
  485. export const InboundSchema = z.object({
  486. clientStats: z.array(z.lazy(() => ClientTrafficSchema)),
  487. disableFlow: z.boolean(),
  488. down: z.number().int(),
  489. enable: z.boolean(),
  490. expiryTime: z.number().int(),
  491. fallbackParent: z.lazy(() => FallbackParentInfoSchema).nullable().optional(),
  492. id: z.number().int(),
  493. lastTrafficResetTime: z.number().int(),
  494. listen: z.string(),
  495. nodeId: z.number().int().nullable().optional(),
  496. originNodeGuid: z.string().optional(),
  497. port: z.number().int().min(0).max(65535),
  498. protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'http', 'mixed', 'tunnel', 'tun', 'mtproto', 'amneziawg']),
  499. remark: z.string(),
  500. settings: z.unknown(),
  501. shareAddr: z.string(),
  502. shareAddrStrategy: z.enum(['node', 'listen', 'custom']),
  503. sniffing: z.unknown(),
  504. streamSettings: z.unknown(),
  505. subSortIndex: z.number().int().min(1),
  506. tag: z.string(),
  507. total: z.number().int(),
  508. trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']),
  509. trafficResetDay: z.number().int().min(1).max(31),
  510. up: z.number().int(),
  511. });
  512. export type Inbound = z.infer<typeof InboundSchema>;
  513. export const InboundClientIpsSchema = z.object({
  514. clientEmail: z.string(),
  515. id: z.number().int(),
  516. ips: z.unknown(),
  517. });
  518. export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
  519. export const InboundFallbackSchema = z.object({
  520. alpn: z.string(),
  521. childId: z.number().int(),
  522. dest: z.string(),
  523. id: z.number().int(),
  524. masterId: z.number().int(),
  525. name: z.string(),
  526. path: z.string(),
  527. sortOrder: z.number().int(),
  528. xver: z.number().int(),
  529. });
  530. export type InboundFallback = z.infer<typeof InboundFallbackSchema>;
  531. export const InboundOptionSchema = z.object({
  532. awgServer: z.lazy(() => ServerSettingsSchema).nullable().optional(),
  533. enable: z.boolean(),
  534. id: z.number().int(),
  535. listen: z.string().optional(),
  536. mtprotoDomain: z.string().optional(),
  537. nodeAddress: z.string().optional(),
  538. nodeId: z.number().int().nullable().optional(),
  539. port: z.number().int(),
  540. protocol: z.string(),
  541. remark: z.string(),
  542. shareAddr: z.string().optional(),
  543. shareAddrStrategy: z.string().optional(),
  544. ssMethod: z.string(),
  545. tag: z.string(),
  546. tlsFlowCapable: z.boolean(),
  547. wgDns: z.string().optional(),
  548. wgMtu: z.number().int().optional(),
  549. wgPublicKey: z.string().optional(),
  550. });
  551. export type InboundOption = z.infer<typeof InboundOptionSchema>;
  552. export const MsgSchema = z.object({
  553. msg: z.string(),
  554. obj: z.unknown(),
  555. success: z.boolean(),
  556. });
  557. export type Msg = z.infer<typeof MsgSchema>;
  558. export const NodeSchema = z.object({
  559. activeCount: z.number().int(),
  560. address: z.string(),
  561. allowPrivateAddress: z.boolean(),
  562. basePath: z.string(),
  563. clientCount: z.number().int(),
  564. configDirty: z.boolean(),
  565. configDirtyAt: z.number().int(),
  566. cpuPct: z.number(),
  567. createdAt: z.number().int(),
  568. depletedCount: z.number().int(),
  569. disabledCount: z.number().int(),
  570. enable: z.boolean(),
  571. guid: z.string(),
  572. id: z.number().int(),
  573. inboundCount: z.number().int(),
  574. inboundSyncMode: z.enum(['all', 'selected']),
  575. inboundTags: z.array(z.string()),
  576. lastError: z.string(),
  577. lastHeartbeat: z.number().int(),
  578. latencyMs: z.number().int(),
  579. memPct: z.number(),
  580. name: z.string(),
  581. netDown: z.number().int(),
  582. netUp: z.number().int(),
  583. onlineCount: z.number().int(),
  584. outboundTag: z.string(),
  585. panelVersion: z.string(),
  586. parentGuid: z.string().optional(),
  587. pinnedCertSha256: z.string(),
  588. port: z.number().int().min(1).max(65535),
  589. remark: z.string(),
  590. scheme: z.enum(['http', 'https']),
  591. status: z.string(),
  592. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  593. transitive: z.boolean().optional(),
  594. updatedAt: z.number().int(),
  595. uptimeSecs: z.number().int(),
  596. xrayError: z.string(),
  597. xrayState: z.string(),
  598. xrayVersion: z.string(),
  599. });
  600. export type Node = z.infer<typeof NodeSchema>;
  601. export const NodeMutationRequestSchema = z.object({
  602. address: z.string(),
  603. allowPrivateAddress: z.boolean(),
  604. apiToken: z.string().nullable().optional(),
  605. basePath: z.string(),
  606. clearApiToken: z.boolean().optional(),
  607. enable: z.boolean(),
  608. id: z.number().int(),
  609. inboundSyncMode: z.enum(['all', 'selected']),
  610. inboundTags: z.array(z.string()),
  611. name: z.string(),
  612. outboundTag: z.string(),
  613. pinnedCertSha256: z.string(),
  614. port: z.number().int().min(1).max(65535),
  615. remark: z.string(),
  616. scheme: z.enum(['http', 'https']),
  617. tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
  618. });
  619. export type NodeMutationRequest = z.infer<typeof NodeMutationRequestSchema>;
  620. export const NodeViewSchema = z.object({
  621. activeCount: z.number().int(),
  622. address: z.string(),
  623. allowPrivateAddress: z.boolean(),
  624. basePath: z.string(),
  625. clientCount: z.number().int(),
  626. configDirty: z.boolean(),
  627. configDirtyAt: z.number().int(),
  628. cpuPct: z.number(),
  629. createdAt: z.number().int(),
  630. depletedCount: z.number().int(),
  631. disabledCount: z.number().int(),
  632. enable: z.boolean(),
  633. guid: z.string(),
  634. hasApiToken: z.boolean(),
  635. id: z.number().int(),
  636. inboundCount: z.number().int(),
  637. inboundSyncMode: z.string(),
  638. inboundTags: z.array(z.string()),
  639. lastError: z.string(),
  640. lastHeartbeat: z.number().int(),
  641. latencyMs: z.number().int(),
  642. memPct: z.number(),
  643. name: z.string(),
  644. netDown: z.number().int(),
  645. netUp: z.number().int(),
  646. onlineCount: z.number().int(),
  647. outboundTag: z.string(),
  648. panelVersion: z.string(),
  649. parentGuid: z.string().optional(),
  650. pinnedCertSha256: z.string(),
  651. port: z.number().int(),
  652. remark: z.string(),
  653. scheme: z.string(),
  654. status: z.string(),
  655. tlsVerifyMode: z.string(),
  656. transitive: z.boolean().optional(),
  657. updatedAt: z.number().int(),
  658. uptimeSecs: z.number().int(),
  659. xrayError: z.string(),
  660. xrayState: z.string(),
  661. xrayVersion: z.string(),
  662. });
  663. export type NodeView = z.infer<typeof NodeViewSchema>;
  664. export const OutboundTrafficsSchema = z.object({
  665. down: z.number().int(),
  666. id: z.number().int(),
  667. tag: z.string(),
  668. total: z.number().int(),
  669. up: z.number().int(),
  670. });
  671. export type OutboundTraffics = z.infer<typeof OutboundTrafficsSchema>;
  672. export const PanelUpdateStatusSchema = z.object({
  673. exitCode: z.number().int(),
  674. finishedAt: z.number().int(),
  675. runId: z.string(),
  676. state: z.string(),
  677. });
  678. export type PanelUpdateStatus = z.infer<typeof PanelUpdateStatusSchema>;
  679. export const PeerActivitySchema = z.object({
  680. allowedIPs: z.string(),
  681. down: z.number().int(),
  682. email: z.string(),
  683. endpoint: z.string(),
  684. handshake: z.number().int(),
  685. inboundId: z.number().int(),
  686. interface: z.string(),
  687. online: z.boolean(),
  688. tag: z.string(),
  689. up: z.number().int(),
  690. });
  691. export type PeerActivity = z.infer<typeof PeerActivitySchema>;
  692. export const ProbeResultUISchema = z.object({
  693. cpuPct: z.number(),
  694. error: z.string(),
  695. latencyMs: z.number().int(),
  696. memPct: z.number(),
  697. panelVersion: z.string(),
  698. status: z.string(),
  699. uptimeSecs: z.number().int(),
  700. xrayError: z.string(),
  701. xrayState: z.string(),
  702. xrayVersion: z.string(),
  703. });
  704. export type ProbeResultUI = z.infer<typeof ProbeResultUISchema>;
  705. export const RealityScanResultSchema = z.object({
  706. alpn: z.string(),
  707. certChainValid: z.boolean(),
  708. certIssuer: z.string(),
  709. certSubject: z.string(),
  710. certValid: z.boolean(),
  711. curveID: z.string(),
  712. feasible: z.boolean(),
  713. h2: z.boolean(),
  714. host: z.string(),
  715. ip: z.string(),
  716. latencyMs: z.number().int(),
  717. notAfter: z.string(),
  718. port: z.number().int(),
  719. privateTarget: z.boolean(),
  720. reason: z.string(),
  721. serverNames: z.array(z.string()),
  722. target: z.string(),
  723. tls13: z.boolean(),
  724. tlsVersion: z.string(),
  725. x25519: z.boolean(),
  726. });
  727. export type RealityScanResult = z.infer<typeof RealityScanResultSchema>;
  728. export const ServerSettingsSchema = z.object({
  729. contentPaddingAddition: z.string().optional(),
  730. disableCookies: z.boolean(),
  731. externalInterface: z.string().optional(),
  732. h1: z.string(),
  733. h2: z.string(),
  734. h3: z.string(),
  735. h4: z.string(),
  736. headerProtectionKey: z.string().optional(),
  737. i1: z.string().optional(),
  738. i2: z.string().optional(),
  739. i3: z.string().optional(),
  740. i4: z.string().optional(),
  741. i5: z.string().optional(),
  742. ipv6Enabled: z.boolean().optional(),
  743. ipv6ExternalInterface: z.string().optional(),
  744. ipv6Subnet: z.string().optional(),
  745. jc: z.number().int(),
  746. jmax: z.number().int(),
  747. jmin: z.number().int(),
  748. keepaliveTimeout: z.string().optional(),
  749. maxHandshakeAttempts: z.string().optional(),
  750. mtu: z.number().int().optional(),
  751. primaryDns: z.string(),
  752. privateKey: z.string(),
  753. publicKey: z.string(),
  754. randomTrailers: z.boolean(),
  755. rejectAfterTime: z.string().optional(),
  756. rekeyAfterTime: z.string().optional(),
  757. rekeyTimeout: z.string().optional(),
  758. routeThroughXray: z.boolean().optional(),
  759. s1: z.number().int(),
  760. s2: z.number().int(),
  761. s3: z.number().int(),
  762. s4: z.number().int(),
  763. secondaryDns: z.string(),
  764. subnetCidr: z.number().int(),
  765. subnetIp: z.string(),
  766. });
  767. export type ServerSettings = z.infer<typeof ServerSettingsSchema>;
  768. export const SettingSchema = z.object({
  769. id: z.number().int(),
  770. key: z.string(),
  771. value: z.string(),
  772. });
  773. export type Setting = z.infer<typeof SettingSchema>;
  774. export const SubBalancerSchema = z.object({
  775. createdAt: z.number().int(),
  776. enabled: z.boolean(),
  777. id: z.number().int(),
  778. inboundIds: z.array(z.number().int()),
  779. memberWeights: z.record(z.number().int(), z.number()).optional(),
  780. remark: z.string().max(256),
  781. sortOrder: z.number().int().min(1),
  782. strategy: z.enum(['leastLoad', 'leastPing', 'random', 'roundRobin']),
  783. updatedAt: z.number().int(),
  784. });
  785. export type SubBalancer = z.infer<typeof SubBalancerSchema>;
  786. export const UserSchema = z.object({
  787. id: z.number().int(),
  788. password: z.string(),
  789. username: z.string(),
  790. });
  791. export type User = z.infer<typeof UserSchema>;