zod.ts 31 KB

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