@gozargah/xray-schema 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1387,7 +1387,7 @@ declare const xraySchema: z.ZodObject<{
1387
1387
  }>>>;
1388
1388
  }, z.core.$strip>>;
1389
1389
  protocol: z.ZodLiteral<"vless">;
1390
- settings: z.ZodObject<{
1390
+ settings: z.ZodUnion<[z.ZodObject<{
1391
1391
  address: z.ZodString;
1392
1392
  port: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>;
1393
1393
  id: z.ZodString;
@@ -1414,7 +1414,22 @@ declare const xraySchema: z.ZodObject<{
1414
1414
  routeOnly: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1415
1415
  }, z.core.$strip>>;
1416
1416
  }, z.core.$strip>>;
1417
- }, z.core.$strip>;
1417
+ }, z.core.$strip>, z.ZodObject<{
1418
+ vnext: z.ZodArray<z.ZodObject<{
1419
+ address: z.ZodString;
1420
+ port: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodString]>;
1421
+ users: z.ZodArray<z.ZodObject<{
1422
+ id: z.ZodString;
1423
+ encryption: z.ZodDefault<z.ZodString>;
1424
+ flow: z.ZodOptional<z.ZodEnum<{
1425
+ "": "";
1426
+ "xtls-rprx-vision": "xtls-rprx-vision";
1427
+ "xtls-rprx-vision-udp443": "xtls-rprx-vision-udp443";
1428
+ }>>;
1429
+ level: z.ZodOptional<z.ZodDefault<z.ZodInt>>;
1430
+ }, z.core.$strip>>;
1431
+ }, z.core.$strip>>;
1432
+ }, z.core.$strip>]>;
1418
1433
  }, z.core.$strip>, z.ZodObject<{
1419
1434
  sendThrough: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodEnum<{
1420
1435
  origin: "origin";
@@ -2732,26 +2732,65 @@ const trojan = outboundSchemaBase.extend({
2732
2732
  settings: trojanServerSettings.or(z.object({ servers: z.array(trojanServerSettings).meta({ markdownDescription: trojanServers_default }) })).meta({ markdownDescription: trojanSettings_default })
2733
2733
  }).meta({ markdownDescription: trojan_default });
2734
2734
  //#endregion
2735
+ //#region src/outbounds/vless/vless.md?raw
2736
+ var vless_default = "VLESS is a stateless lightweight transport protocol. It consists of inbound and outbound parts and can serve as a bridge between the Xray client and server.\n\nUnlike [VMess](https://xtls.github.io/en/config/outbounds/vmess.html), VLESS does not depend on system time. The authentication method is also UUID.\n\n[Documentation ↗](https://xtls.github.io/en/config/outbounds/vless.html)\n";
2737
+ //#endregion
2738
+ //#region src/outbounds/vless/vlessSettings.md?raw
2739
+ var vlessSettings_default = "`OutboundConfigurationObject` corresponds to the `settings` item in [`OutboundObject`](https://xtls.github.io/en/config/outbound.html).\n";
2740
+ //#endregion
2741
+ //#region src/outbounds/vless/vlessAddress.md?raw
2742
+ var vlessAddress_default = "Server address, points to the server. Supports domain names, IPv4, and IPv6.\n";
2743
+ //#endregion
2744
+ //#region src/outbounds/vless/vlessPort.md?raw
2745
+ var vlessPort_default = "Server port, usually the same as the port the server is listening on.\n";
2746
+ //#endregion
2747
+ //#region src/outbounds/vless/vlessId.md?raw
2748
+ var vlessId_default = "User ID for VLESS. It can be any string less than 30 bytes, or a valid UUID. A custom string and its mapped UUID are equivalent.\n\nThe mapping standard is described in [VLESS UUID Mapping Standard: Mapping Custom Strings to UUIDv5](https://github.com/XTLS/Xray-core/issues/158).\n\nYou can use the command `xray uuid -i \"custom string\"` to generate the UUID mapped from a custom string, or use the command `xray uuid` to generate a random UUID.\n";
2749
+ //#endregion
2750
+ //#region src/outbounds/vless/vlessEncryption.md?raw
2751
+ var vlessEncryption_default = "[VLESS Encryption](https://github.com/XTLS/Xray-core/pull/5067) settings. Cannot be left empty; to disable, explicitly set to `\"none\"`.\n\nIt is recommended for most users to use the `xray vlessenc` command to automatically generate this field to avoid configuration mistakes. The detailed configuration below is recommended only for advanced users.\n\nIts format is a detailed configuration string of fields connected by `.`. For example: `mlkem768x25519plus.native.0rtt.100-111-1111.75-0-111.50-0-3333.ptjHQxBQxTJ9MWr2cd5qWIflBSACHOevTauCQwa_71U`. This document will refer to the separate parts separated by dots as \"blocks\".\n\n- **The 1st block** is the handshake method. Currently, there is only `mlkem768x25519plus`. Requires consistency between server and client.\n- **The 2nd block** is the encryption method. Options are `native`/`xorpub`/`random`, corresponding to: raw format packet / raw format + obfuscated public key part / fully random numbers (similar to VMESS/Shadowsocks). Requires consistency between server and client.\n- **The 3rd block** is session resumption. Choosing `0rtt` will follow the server settings to attempt to use previously generated tickets to skip the handshake for fast connection (can be manually disabled by the server). Choosing `1rtt` will force a 1-RTT handshake process. The meaning here differs from the server setting; see VLESS Inbound `decryption` settings for details.\n\nFollowing blocks are **padding**. After the connection is established, the client sends some garbage data to obfuscate length characteristics. It does not need to be the same as the server (the corresponding part in the inbound is the padding sent from the server to the client). It is a variable-length part with the format `padding.delay.padding` + `(.delay.padding)` x n (multiple padding blocks can be inserted, requiring a delay block between two padding blocks).\n\n- `padding` format is `probability-min-max`. E.g., `100-111-1111` means 100% probability to send a padding of length 111~1111.\n- `delay` format is also `probability-min-max`. E.g., `75-0-111` means 75% probability to wait 0~111 milliseconds.\n\nThe first padding block has special requirements: probability must be 100% and minimum length greater than 0. If no padding exists, the core automatically uses `100-111-1111.75-0-111.50-0-3333` as the padding setting.\n\n**The last block** will be recognized by the core as the parameter used to authenticate the server. It can be generated by `./xray x25519` (using the Password part) or `./xray mlkem768` (using the Client part). It must correspond to the server. `mlkem768` belongs to post-quantum algorithms, preventing (future) client parameter leaks from allowing quantum computers to crack the private key and impersonate the server. This parameter is only used for verification; the handshake process is post-quantum secure regardless, and existing encrypted data cannot be decrypted by future quantum computers.\n";
2752
+ //#endregion
2753
+ //#region src/outbounds/vless/vlessFlow.md?raw
2754
+ var vlessFlow_default = "Flow control mode, used to select the XTLS algorithm.\n\nCurrently, the following flow control modes are available in the outbound protocol:\n\n- **No `flow` or empty string**: Use standard TLS proxy.\n- **`xtls-rprx-vision`**: Use XTLS, including inner handshake random padding. Will intercept UDP traffic targeting port 443 (QUIC) to force browsers to use standard HTTPS, increasing traffic that can be Spliced.\n- **`xtls-rprx-vision-udp443`**: Same as `xtls-rprx-vision`, but does not intercept UDP 443. Used when a program forces the use of QUIC and would fail to work if intercepted.\n\nXTLS is available only in the following combinations:\n\n- **TCP+TLS/REALITY**: In this case, if transmitting TLS 1.3, the core will attempt to Splice encrypted data at the bottom layer. If successful, it saves all core IO overhead.\n- **VLESS Encryption**: No underlying transport restrictions. If the underlying transport is not TCP, it only attempts to penetrate Encryption, saving Encryption overhead. If it is TCP, it will still attempt to perform Splice.\n\n### TIP\n\nSplice is a function provided by the Linux Kernel. The system kernel forwards TCP directly, no longer passing through Xray's memory, greatly reducing data copying and CPU context switching.\n\nWhen using Vision mode, Splice is automatically enabled if the following conditions are met:\n\n- Linux environment.\n- Inbound protocol is a pure TCP connection like `Dokodemo door`, `Socks`, `HTTP`, or other inbound protocols using XTLS.\n- Outbound protocol is VLESS + XTLS.\n\nWhen using Splice, the network speed display will lag and will only be counted after the connection is disconnected because the core cannot know the traffic situation while the kernel takes over the connection.\n";
2755
+ //#endregion
2756
+ //#region src/outbounds/vless/vlessLevel.md?raw
2757
+ var vlessLevel_default = "User level. The connection will use the [Local Policy](https://xtls.github.io/en/config/policy.html#levelpolicyobject) corresponding to this user level.\n\nThe value of `level` corresponds to the value of `level` in [policy](https://xtls.github.io/en/config/policy.html#policyobject). If not specified, it defaults to 0.\n";
2758
+ //#endregion
2735
2759
  //#region src/outbounds/vless/vless.ts
2736
- const vless = outboundSchemaBase.extend({
2737
- protocol: z.literal("vless"),
2738
- settings: z.object({
2739
- address: z.string().meta({ markdownDescription: "Server address, points to the server. Supports domain names, IPv4, and IPv6.\n" }),
2740
- port: portLikeSchema.meta({ markdownDescription: "Server port, usually the same as the port the server is listening on.\n" }),
2741
- id: z.string().meta({ markdownDescription: "User ID for VLESS. It can be any string less than 30 bytes, or a valid UUID. A custom string and its mapped UUID are equivalent.\n\nThe mapping standard is described in [VLESS UUID Mapping Standard: Mapping Custom Strings to UUIDv5](https://github.com/XTLS/Xray-core/issues/158).\n\nYou can use the command `xray uuid -i \"custom string\"` to generate the UUID mapped from a custom string, or use the command `xray uuid` to generate a random UUID.\n" }),
2742
- encryption: z.string().default("none").meta({ markdownDescription: "[VLESS Encryption](https://github.com/XTLS/Xray-core/pull/5067) settings. Cannot be left empty; to disable, explicitly set to `\"none\"`.\n\nIt is recommended for most users to use the `xray vlessenc` command to automatically generate this field to avoid configuration mistakes. The detailed configuration below is recommended only for advanced users.\n\nIts format is a detailed configuration string of fields connected by `.`. For example: `mlkem768x25519plus.native.0rtt.100-111-1111.75-0-111.50-0-3333.ptjHQxBQxTJ9MWr2cd5qWIflBSACHOevTauCQwa_71U`. This document will refer to the separate parts separated by dots as \"blocks\".\n\n- **The 1st block** is the handshake method. Currently, there is only `mlkem768x25519plus`. Requires consistency between server and client.\n- **The 2nd block** is the encryption method. Options are `native`/`xorpub`/`random`, corresponding to: raw format packet / raw format + obfuscated public key part / fully random numbers (similar to VMESS/Shadowsocks). Requires consistency between server and client.\n- **The 3rd block** is session resumption. Choosing `0rtt` will follow the server settings to attempt to use previously generated tickets to skip the handshake for fast connection (can be manually disabled by the server). Choosing `1rtt` will force a 1-RTT handshake process. The meaning here differs from the server setting; see VLESS Inbound `decryption` settings for details.\n\nFollowing blocks are **padding**. After the connection is established, the client sends some garbage data to obfuscate length characteristics. It does not need to be the same as the server (the corresponding part in the inbound is the padding sent from the server to the client). It is a variable-length part with the format `padding.delay.padding` + `(.delay.padding)` x n (multiple padding blocks can be inserted, requiring a delay block between two padding blocks).\n\n- `padding` format is `probability-min-max`. E.g., `100-111-1111` means 100% probability to send a padding of length 111~1111.\n- `delay` format is also `probability-min-max`. E.g., `75-0-111` means 75% probability to wait 0~111 milliseconds.\n\nThe first padding block has special requirements: probability must be 100% and minimum length greater than 0. If no padding exists, the core automatically uses `100-111-1111.75-0-111.50-0-3333` as the padding setting.\n\n**The last block** will be recognized by the core as the parameter used to authenticate the server. It can be generated by `./xray x25519` (using the Password part) or `./xray mlkem768` (using the Client part). It must correspond to the server. `mlkem768` belongs to post-quantum algorithms, preventing (future) client parameter leaks from allowing quantum computers to crack the private key and impersonate the server. This parameter is only used for verification; the handshake process is post-quantum secure regardless, and existing encrypted data cannot be decrypted by future quantum computers.\n" }),
2760
+ const vlessSettings = z.object({
2761
+ address: z.string().meta({ markdownDescription: vlessAddress_default }),
2762
+ port: portLikeSchema.meta({ markdownDescription: vlessPort_default }),
2763
+ id: z.string().meta({ markdownDescription: vlessId_default }),
2764
+ encryption: z.string().default("none").meta({ markdownDescription: vlessEncryption_default }),
2765
+ flow: z.enum([
2766
+ "",
2767
+ "xtls-rprx-vision",
2768
+ "xtls-rprx-vision-udp443"
2769
+ ]).optional().meta({ markdownDescription: vlessFlow_default }),
2770
+ level: z.int().default(0).optional().meta({ markdownDescription: vlessLevel_default }),
2771
+ reverse: z.object({
2772
+ tag: z.string().meta({ markdownDescription: "The inbound proxy tag for this reverse proxy. When the server dispatches a reverse proxy request, it enters the routing system from the inbound using this tag, and the routing system routes it to the outbound you need.\n" }),
2773
+ sniffing: sniffingSchema.optional()
2774
+ }).optional().meta({ markdownDescription: "VLESS minimalist reverse proxy configuration. It preserves the real source IP information from the public-facing side.\n\nThe existence of this item indicates that this outbound can be used as a VLESS reverse proxy outbound, and it will automatically establish a connection to the server to register the reverse proxy tunnel.\n\n`tag` is the inbound proxy tag for this reverse proxy. When the server dispatches a reverse proxy request, it enters the routing system from the inbound using this tag, and the routing system routes it to the outbound you need.\n\nThe UUID used must be one that is also configured with `reverse` on the server side (see VLESS Inbound for details).\n\n`sniffing` see [SniffingObject](https://xtls.github.io/en/config/inbound.html#sniffingobject), performs sniffing on requests entering through this reverse proxy.\n\n### TIP\n\nFull tutorial: [VLESS Reverse Proxy Examples](https://xtls.github.io/en/document/level-2/vless_reverse.html)\n" })
2775
+ }).meta({ markdownDescription: vlessSettings_default });
2776
+ const vnext = z.object({ vnext: z.array(z.object({
2777
+ address: z.string().meta({ markdownDescription: vlessAddress_default }),
2778
+ port: portLikeSchema.meta({ markdownDescription: vlessPort_default }),
2779
+ users: z.array(z.object({
2780
+ id: z.string().meta({ markdownDescription: vlessId_default }),
2781
+ encryption: z.string().default("none").meta({ markdownDescription: vlessEncryption_default }),
2743
2782
  flow: z.enum([
2744
2783
  "",
2745
2784
  "xtls-rprx-vision",
2746
2785
  "xtls-rprx-vision-udp443"
2747
- ]).optional().meta({ markdownDescription: "Flow control mode, used to select the XTLS algorithm.\n\nCurrently, the following flow control modes are available in the outbound protocol:\n\n- **No `flow` or empty string**: Use standard TLS proxy.\n- **`xtls-rprx-vision`**: Use XTLS, including inner handshake random padding. Will intercept UDP traffic targeting port 443 (QUIC) to force browsers to use standard HTTPS, increasing traffic that can be Spliced.\n- **`xtls-rprx-vision-udp443`**: Same as `xtls-rprx-vision`, but does not intercept UDP 443. Used when a program forces the use of QUIC and would fail to work if intercepted.\n\nXTLS is available only in the following combinations:\n\n- **TCP+TLS/REALITY**: In this case, if transmitting TLS 1.3, the core will attempt to Splice encrypted data at the bottom layer. If successful, it saves all core IO overhead.\n- **VLESS Encryption**: No underlying transport restrictions. If the underlying transport is not TCP, it only attempts to penetrate Encryption, saving Encryption overhead. If it is TCP, it will still attempt to perform Splice.\n\n### TIP\n\nSplice is a function provided by the Linux Kernel. The system kernel forwards TCP directly, no longer passing through Xray's memory, greatly reducing data copying and CPU context switching.\n\nWhen using Vision mode, Splice is automatically enabled if the following conditions are met:\n\n- Linux environment.\n- Inbound protocol is a pure TCP connection like `Dokodemo door`, `Socks`, `HTTP`, or other inbound protocols using XTLS.\n- Outbound protocol is VLESS + XTLS.\n\nWhen using Splice, the network speed display will lag and will only be counted after the connection is disconnected because the core cannot know the traffic situation while the kernel takes over the connection.\n" }),
2748
- level: z.int().default(0).optional().meta({ markdownDescription: "User level. The connection will use the [Local Policy](https://xtls.github.io/en/config/policy.html#levelpolicyobject) corresponding to this user level.\n\nThe value of `level` corresponds to the value of `level` in [policy](https://xtls.github.io/en/config/policy.html#policyobject). If not specified, it defaults to 0.\n" }),
2749
- reverse: z.object({
2750
- tag: z.string().meta({ markdownDescription: "The inbound proxy tag for this reverse proxy. When the server dispatches a reverse proxy request, it enters the routing system from the inbound using this tag, and the routing system routes it to the outbound you need.\n" }),
2751
- sniffing: sniffingSchema.optional()
2752
- }).optional().meta({ markdownDescription: "VLESS minimalist reverse proxy configuration. It preserves the real source IP information from the public-facing side.\n\nThe existence of this item indicates that this outbound can be used as a VLESS reverse proxy outbound, and it will automatically establish a connection to the server to register the reverse proxy tunnel.\n\n`tag` is the inbound proxy tag for this reverse proxy. When the server dispatches a reverse proxy request, it enters the routing system from the inbound using this tag, and the routing system routes it to the outbound you need.\n\nThe UUID used must be one that is also configured with `reverse` on the server side (see VLESS Inbound for details).\n\n`sniffing` see [SniffingObject](https://xtls.github.io/en/config/inbound.html#sniffingobject), performs sniffing on requests entering through this reverse proxy.\n\n### TIP\n\nFull tutorial: [VLESS Reverse Proxy Examples](https://xtls.github.io/en/document/level-2/vless_reverse.html)\n" })
2753
- }).meta({ markdownDescription: "`OutboundConfigurationObject` corresponds to the `settings` item in [`OutboundObject`](https://xtls.github.io/en/config/outbound.html).\n" })
2754
- }).meta({ markdownDescription: "VLESS is a stateless lightweight transport protocol. It consists of inbound and outbound parts and can serve as a bridge between the Xray client and server.\n\nUnlike [VMess](https://xtls.github.io/en/config/outbounds/vmess.html), VLESS does not depend on system time. The authentication method is also UUID.\n\n[Documentation ↗](https://xtls.github.io/en/config/outbounds/vless.html)\n" });
2786
+ ]).optional().meta({ markdownDescription: vlessFlow_default }),
2787
+ level: z.int().default(0).optional().meta({ markdownDescription: vlessLevel_default })
2788
+ }))
2789
+ })) });
2790
+ const vless = outboundSchemaBase.extend({
2791
+ protocol: z.literal("vless"),
2792
+ settings: vlessSettings.or(vnext).meta({ markdownDescription: vlessSettings_default })
2793
+ }).meta({ markdownDescription: vless_default });
2755
2794
  //#endregion
2756
2795
  //#region src/outbounds/vmess/vmess.ts
2757
2796
  const vmess = outboundSchemaBase.extend({