import { StreamSettingsConfig } from '../transport/stream'; import { SniffingConfig } from './sniffing'; import { VLessInboundConfig } from '../proxies/vless'; import { VMessInboundConfig } from '../proxies/vmess'; import { TrojanInboundConfig } from '../proxies/trojan'; import { ShadowsocksInboundConfig } from '../proxies/shadowsocks'; import { SocksInboundConfig } from '../proxies/socks'; import { HTTPInboundConfig } from '../proxies/http'; import { DokodemoInboundConfig } from '../proxies/dokodemo'; import { HysteriaInboundConfig } from '../proxies/hysteria'; /** * Common inbound fields shared by all protocol variants. */ interface InboundConfigBase { /** Listening port. Can be a number, string range "1-65535", or comma-separated. */ port?: number | string; /** Listening address (default: "0.0.0.0"). */ listen?: string; /** Unique tag for routing reference. */ tag?: string; /** Transport layer settings. */ streamSettings?: StreamSettingsConfig; /** Traffic sniffing configuration. */ sniffing?: SniffingConfig; } /** * Discriminated union of all inbound configurations. * TypeScript will automatically narrow `settings` based on `protocol`. * * @example * ```typescript * if (inbound.protocol === 'shadowsocks') { * inbound.settings?.method; // OK — ShadowsocksInboundConfig * } * ``` * * @see https://xtls.github.io/en/config/inbound.html */ export type InboundConfig = InboundVLess | InboundVMess | InboundTrojan | InboundShadowsocks | InboundSocks | InboundHTTP | InboundDokodemo | InboundTunnel | InboundMixed | InboundHysteria; export interface InboundVLess extends InboundConfigBase { protocol: 'vless'; settings?: VLessInboundConfig; } export interface InboundVMess extends InboundConfigBase { protocol: 'vmess'; settings?: VMessInboundConfig; } export interface InboundTrojan extends InboundConfigBase { protocol: 'trojan'; settings?: TrojanInboundConfig; } export interface InboundShadowsocks extends InboundConfigBase { protocol: 'shadowsocks'; settings?: ShadowsocksInboundConfig; } export interface InboundSocks extends InboundConfigBase { protocol: 'socks'; settings?: SocksInboundConfig; } export interface InboundHTTP extends InboundConfigBase { protocol: 'http'; settings?: HTTPInboundConfig; } export interface InboundDokodemo extends InboundConfigBase { protocol: 'dokodemo-door'; settings?: DokodemoInboundConfig; } /** Alias for dokodemo-door in Xray-Core. Same settings. */ export interface InboundTunnel extends InboundConfigBase { protocol: 'tunnel'; settings?: DokodemoInboundConfig; } /** Alias for combined http+socks in Xray-Core. Accepts both setting types. */ export interface InboundMixed extends InboundConfigBase { protocol: 'mixed'; settings?: SocksInboundConfig | HTTPInboundConfig; } export interface InboundHysteria extends InboundConfigBase { protocol: 'hysteria'; settings?: HysteriaInboundConfig; } /** Fallback for unknown/custom protocols. */ export interface InboundGeneric extends InboundConfigBase { protocol?: string; settings?: Record; } /** * Union type for all possible inbound protocol settings. */ export type InboundSettings = VLessInboundConfig | VMessInboundConfig | TrojanInboundConfig | ShadowsocksInboundConfig | SocksInboundConfig | HTTPInboundConfig | DokodemoInboundConfig | HysteriaInboundConfig; export type InboundProtocol = 'vless' | 'vmess' | 'trojan' | 'shadowsocks' | 'socks' | 'http' | 'dokodemo-door' | 'tunnel' | 'mixed' | 'hysteria'; export {}; //# sourceMappingURL=inbound.d.ts.map