xray-configurator — API
ExampleConfig
Section titled “ExampleConfig”src/domain/exampleCatalog.generated.ts
export type ExampleConfig = Record<string, unknown>;ExampleCatalogItem
Section titled “ExampleCatalogItem”src/domain/exampleCatalog.generated.ts
export interface ExampleCatalogItem { id: string; title: string; path: string; role: 'server' | 'client' | 'mixed' | 'other'; protocols: string[]; transports: string[]; securities: string[]; features: string[]; raw: string; config: ExampleConfig | null;}ConfigPreset
Section titled “ConfigPreset”export interface ConfigPreset { id: string; label: string; labelRu: string; description: string; descriptionRu: string; create: () => XrayConfig;}ValidationSeverity
Section titled “ValidationSeverity”export type ValidationSeverity = 'error' | 'warning';ValidationIssue
Section titled “ValidationIssue”export interface ValidationIssue { path: string; severity: ValidationSeverity; message: string; messageRu: string;}validateConfig
Section titled “validateConfig”export function validateConfig(config: XrayConfig): ValidationIssue[]Language
Section titled “Language”export type Language = 'en' | 'ru';JsonValue
Section titled “JsonValue”export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };XrayConfig
Section titled “XrayConfig”export interface XrayConfig { log?: Record<string, JsonValue>; api?: Record<string, JsonValue>; dns?: Record<string, JsonValue>; routing?: Record<string, JsonValue>; policy?: Record<string, JsonValue>; inbounds?: InboundConfig[]; outbounds?: OutboundConfig[]; stats?: Record<string, JsonValue>; fakeDns?: Record<string, JsonValue>; metrics?: Record<string, JsonValue>; observatory?: Record<string, JsonValue>; burstObservatory?: Record<string, JsonValue>; geodata?: Record<string, JsonValue>; version?: Record<string, JsonValue>;}InboundConfig
Section titled “InboundConfig”export interface InboundConfig { tag: string; listen?: string; port?: number | string; protocol: InboundProtocol; settings: Record<string, JsonValue>; streamSettings?: StreamSettings; sniffing?: Record<string, JsonValue>;}OutboundConfig
Section titled “OutboundConfig”export interface OutboundConfig { tag: string; protocol: OutboundProtocol; settings: Record<string, JsonValue>; sendThrough?: string; targetStrategy?: string; streamSettings?: StreamSettings; proxySettings?: Record<string, JsonValue>; mux?: Record<string, JsonValue>;}InboundProtocol
Section titled “InboundProtocol”export type InboundProtocol = | 'vless' | 'vmess' | 'trojan' | 'shadowsocks' | 'socks' | 'mixed' | 'http' | 'dokodemo-door' | 'wireguard' | 'hysteria' | 'tun';OutboundProtocol
Section titled “OutboundProtocol”export type OutboundProtocol = | 'freedom' | 'blackhole' | 'dns' | 'vless' | 'vmess' | 'trojan' | 'shadowsocks' | 'socks' | 'http' | 'wireguard' | 'hysteria' | 'loopback';TransportProtocol
Section titled “TransportProtocol”export type TransportProtocol = 'raw' | 'tcp' | 'ws' | 'grpc' | 'xhttp' | 'splithttp' | 'kcp' | 'httpupgrade' | 'hysteria';SecurityProtocol
Section titled “SecurityProtocol”export type SecurityProtocol = 'none' | 'tls' | 'reality';StreamSettings
Section titled “StreamSettings”export interface StreamSettings { network?: TransportProtocol; security?: SecurityProtocol; tcpSettings?: Record<string, JsonValue>; rawSettings?: Record<string, JsonValue>; wsSettings?: Record<string, JsonValue>; grpcSettings?: Record<string, JsonValue>; xhttpSettings?: Record<string, JsonValue>; splithttpSettings?: Record<string, JsonValue>; kcpSettings?: Record<string, JsonValue>; httpupgradeSettings?: Record<string, JsonValue>; hysteriaSettings?: Record<string, JsonValue>; tlsSettings?: Record<string, JsonValue>; realitySettings?: Record<string, JsonValue>; sockopt?: Record<string, JsonValue>;}FieldDefinition
Section titled “FieldDefinition”export interface FieldDefinition { key: string; label: string; labelRu: string; help: string; helpRu: string; kind: 'text' | 'number' | 'switch' | 'select' | 'tags' | 'textarea' | 'json' | 'password'; options?: string[]; placeholder?: string; secret?: boolean;}ProtocolDefinition
Section titled “ProtocolDefinition”export interface ProtocolDefinition { value: string; label: string; server: boolean; help: string; helpRu: string; fields: FieldDefinition[]; defaultSettings: Record<string, JsonValue>;}export function field( key: string, label: string, labelRu: string, help: string, helpRu: string, kind: FieldDefinition['kind'], options?: string[], placeholder?: string,): FieldDefinitionrandomHex
Section titled “randomHex”export function randomHex(bytes: number): stringrandomBase64Url
Section titled “randomBase64Url”export function randomBase64Url(bytes: number): stringrandomToken
Section titled “randomToken”export function randomToken(bytes = 18): stringpruneEmpty
Section titled “pruneEmpty”export function pruneEmpty(value: JsonValue): JsonValue | undefinedgetProtocol
Section titled “getProtocol”export function getProtocol<T extends ProtocolDefinition>(items: T[], value: string): T