import { StreamSettingsConfig } from '../transport/stream'; import { MuxConfig } from './mux'; import { VLessOutboundConfig } from '../proxies/vless'; import { VMessOutboundConfig } from '../proxies/vmess'; import { TrojanOutboundConfig } from '../proxies/trojan'; import { ShadowsocksOutboundConfig } from '../proxies/shadowsocks'; import { SocksOutboundConfig } from '../proxies/socks'; import { HTTPOutboundConfig } from '../proxies/http'; import { FreedomOutboundConfig } from '../proxies/freedom'; import { BlackholeOutboundConfig } from '../proxies/blackhole'; import { DNSOutboundConfig } from '../proxies/dns'; import { WireGuardOutboundConfig } from '../proxies/wireguard'; import { LoopbackOutboundConfig } from '../proxies/loopback'; import { HysteriaOutboundConfig } from '../proxies/hysteria'; /** * Common outbound fields shared by all protocol variants. */ interface OutboundConfigBase { /** Send traffic through specific local address. */ sendThrough?: string; /** Unique tag for routing reference. */ tag?: string; /** Transport layer settings. */ streamSettings?: StreamSettingsConfig; /** Proxy chain settings. */ proxySettings?: ProxySettings; /** Mux (multiplexing) settings. */ mux?: MuxConfig; /** Target strategy. */ targetStrategy?: string; /** Remnawave Custom Field, snippet configuration for rule matching. */ snippet?: string; } export interface ProxySettings { /** Tag of another outbound to chain through. */ tag?: string; /** Use transport layer proxying (instead of application layer). */ transportLayer?: boolean; } /** * Discriminated union of all outbound configurations. * TypeScript will automatically narrow `settings` based on `protocol`. * * @example * ```typescript * if (outbound.protocol === 'freedom') { * outbound.settings?.fragment; // OK — FreedomOutboundConfig * } * ``` * * @see https://xtls.github.io/en/config/outbound.html */ export type OutboundConfig = OutboundVLess | OutboundVMess | OutboundTrojan | OutboundShadowsocks | OutboundSocks | OutboundHTTP | OutboundFreedom | OutboundBlackhole | OutboundDNS | OutboundWireGuard | OutboundLoopback | OutboundHysteria; export interface OutboundVLess extends OutboundConfigBase { protocol: 'vless'; settings?: VLessOutboundConfig; } export interface OutboundVMess extends OutboundConfigBase { protocol: 'vmess'; settings?: VMessOutboundConfig; } export interface OutboundTrojan extends OutboundConfigBase { protocol: 'trojan'; settings?: TrojanOutboundConfig; } export interface OutboundShadowsocks extends OutboundConfigBase { protocol: 'shadowsocks'; settings?: ShadowsocksOutboundConfig; } export interface OutboundSocks extends OutboundConfigBase { protocol: 'socks'; settings?: SocksOutboundConfig; } export interface OutboundHTTP extends OutboundConfigBase { protocol: 'http'; settings?: HTTPOutboundConfig; } export interface OutboundFreedom extends OutboundConfigBase { protocol: 'freedom'; settings?: FreedomOutboundConfig; } export interface OutboundBlackhole extends OutboundConfigBase { protocol: 'blackhole'; settings?: BlackholeOutboundConfig; } export interface OutboundDNS extends OutboundConfigBase { protocol: 'dns'; settings?: DNSOutboundConfig; } export interface OutboundWireGuard extends OutboundConfigBase { protocol: 'wireguard'; settings?: WireGuardOutboundConfig; } export interface OutboundLoopback extends OutboundConfigBase { protocol: 'loopback'; settings?: LoopbackOutboundConfig; } export interface OutboundHysteria extends OutboundConfigBase { protocol: 'hysteria'; settings?: HysteriaOutboundConfig; } /** Fallback for unknown/custom protocols. */ export interface OutboundGeneric extends OutboundConfigBase { protocol?: string; settings?: Record; } /** * Union type for all possible outbound protocol settings. */ export type OutboundSettings = VLessOutboundConfig | VMessOutboundConfig | TrojanOutboundConfig | ShadowsocksOutboundConfig | SocksOutboundConfig | HTTPOutboundConfig | FreedomOutboundConfig | BlackholeOutboundConfig | DNSOutboundConfig | WireGuardOutboundConfig | LoopbackOutboundConfig | HysteriaOutboundConfig; export type OutboundProtocol = 'vless' | 'vmess' | 'trojan' | 'shadowsocks' | 'socks' | 'http' | 'freedom' | 'blackhole' | 'dns' | 'wireguard' | 'loopback' | 'hysteria'; export {}; //# sourceMappingURL=outbound.d.ts.map