Outbound modal
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
export interface Brutal {
|
||||
enabled: boolean
|
||||
up_mbps: number
|
||||
down_mbps: number
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
interface Brutal {
|
||||
enabled: boolean
|
||||
up_mbps: number
|
||||
down_mbps: number
|
||||
}
|
||||
|
||||
export interface iMultiplex{
|
||||
enabled: boolean
|
||||
padding?: boolean
|
||||
brutal?: Brutal
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { iMultiplex } from "./inMultiplex"
|
||||
import { iMultiplex } from "./multiplex"
|
||||
import { iTls } from "./inTls"
|
||||
import { Dial } from "./outbounds"
|
||||
import { Transport } from "./transport"
|
||||
@@ -119,10 +119,7 @@ export interface Naive extends InboundBasics {
|
||||
export interface Hysteria extends InboundBasics {
|
||||
up_mbps: number
|
||||
down_mbps: number
|
||||
obfs?: {
|
||||
type?: "salamander"
|
||||
password?: string
|
||||
}
|
||||
obfs?: string
|
||||
users: NameAuth[]
|
||||
recv_window_conn?: number
|
||||
recv_window_client?: number
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Brutal } from "./brutal"
|
||||
|
||||
export interface iMultiplex{
|
||||
enabled: boolean
|
||||
padding?: boolean
|
||||
brutal?: Brutal
|
||||
}
|
||||
|
||||
export interface oMultiplex extends iMultiplex{
|
||||
protocol?: "smux" | "yamux" | "h2mux"
|
||||
max_connections?: number
|
||||
min_streams?: number
|
||||
max_streams?: number
|
||||
}
|
||||
@@ -1,3 +1,50 @@
|
||||
export interface oTls {
|
||||
enabled?: boolean
|
||||
disable_sni?: boolean
|
||||
server_name?: string
|
||||
insecure?: boolean
|
||||
alpn?: string[]
|
||||
min_version?: string
|
||||
max_version?: string
|
||||
cipher_suites?: string[]
|
||||
certificate?: string
|
||||
certificate_path?: string
|
||||
ech?: {
|
||||
enabled: boolean
|
||||
pq_signature_schemes_enabled?: boolean
|
||||
dynamic_record_sizing_disabled?: boolean
|
||||
config?: string[],
|
||||
config_path?: string
|
||||
},
|
||||
utls?: {
|
||||
enabled: boolean
|
||||
fingerprint: string
|
||||
},
|
||||
reality?: {
|
||||
enabled: boolean
|
||||
public_key: string
|
||||
short_id: string
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultOutTls: oTls = {
|
||||
alpn: ['h3', 'h2', 'http/1.1'],
|
||||
min_version: "1.2",
|
||||
max_version: "1.3",
|
||||
cipher_suites: [],
|
||||
utls: {
|
||||
enabled: true,
|
||||
fingerprint: "chrome",
|
||||
},
|
||||
reality: {
|
||||
enabled: true,
|
||||
public_key: "",
|
||||
short_id: "",
|
||||
},
|
||||
ech: {
|
||||
enabled: true,
|
||||
pq_signature_schemes_enabled: false,
|
||||
dynamic_record_sizing_disabled: false,
|
||||
config_path: "",
|
||||
}
|
||||
}
|
||||
+208
-13
@@ -1,4 +1,6 @@
|
||||
import { oTls } from "./outTls"
|
||||
import { oMultiplex } from "./multiplex"
|
||||
import { Transport } from "./transport"
|
||||
|
||||
export const OutTypes = {
|
||||
Direct: 'direct',
|
||||
@@ -14,7 +16,7 @@ export const OutTypes = {
|
||||
ShadowTLS: 'shadowtls',
|
||||
TUIC: 'tuic',
|
||||
Hysteria2: 'hysteria2',
|
||||
Tur: 'tur',
|
||||
Tor: 'tor',
|
||||
SSH: 'ssh',
|
||||
DNS: 'dns',
|
||||
Selector: 'selector',
|
||||
@@ -43,12 +45,205 @@ interface OutboundBasics {
|
||||
tag: string
|
||||
}
|
||||
|
||||
export interface WgPeer {
|
||||
server: string
|
||||
server_port: number
|
||||
public_key: string
|
||||
pre_shared_key?: string
|
||||
allowed_ips?: string[]
|
||||
reserved?: number[]
|
||||
}
|
||||
|
||||
export interface Direct extends OutboundBasics, Dial {
|
||||
override_address?: string
|
||||
override_port?: number
|
||||
proxy_protocol?: 0 | 1 | 2
|
||||
}
|
||||
|
||||
export interface Block extends OutboundBasics {}
|
||||
|
||||
export interface SOCKS extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
version?: "4" | "4a" | "5"
|
||||
username?: string
|
||||
password?: string
|
||||
network?: "udp" | "tcp"
|
||||
udp_over_tcp?: false | {
|
||||
enabled: true
|
||||
version?: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface HTTP extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
username?: string
|
||||
password?: string
|
||||
path?: string
|
||||
headers?: {
|
||||
[key: string]: string
|
||||
}
|
||||
tls?: oTls
|
||||
}
|
||||
|
||||
export interface Shadowsocks extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
method: string
|
||||
password: string
|
||||
network?: "udp" | "tcp"
|
||||
udp_over_tcp?: false | {
|
||||
enabled: true
|
||||
version?: number
|
||||
}
|
||||
multiplex?: oMultiplex
|
||||
}
|
||||
|
||||
export interface VMESS extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
uuid: string
|
||||
security?: string
|
||||
alter_id: 0
|
||||
global_padding?: boolean
|
||||
authenticated_length?: boolean
|
||||
network?: "udp" | "tcp"
|
||||
packet_encoding?: string
|
||||
tls?: oTls
|
||||
multiplex?: oMultiplex
|
||||
transport?: Transport
|
||||
}
|
||||
|
||||
export interface Trojan extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
password: string
|
||||
network?: "udp" | "tcp"
|
||||
tls?: oTls
|
||||
multiplex?: oMultiplex
|
||||
transport?: Transport
|
||||
}
|
||||
|
||||
export interface WireGuard extends OutboundBasics, Dial {
|
||||
server?: string
|
||||
server_port?: number
|
||||
system_interface?: boolean
|
||||
gso?: boolean
|
||||
interface_name?: string
|
||||
local_address: string[]
|
||||
private_key: string
|
||||
peers?: WgPeer[]
|
||||
peer_public_key?: string
|
||||
pre_shared_key?: string
|
||||
reserved?: number[]
|
||||
workers?: number
|
||||
mtu?: number
|
||||
network?: "udp" | "tcp"
|
||||
}
|
||||
|
||||
export interface Hysteria extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
up_mbps: number
|
||||
down_mbps: number
|
||||
obfs?: string
|
||||
auth_str?: string
|
||||
recv_window_conn?: number
|
||||
recv_window?: number
|
||||
disable_mtu_discovery?: boolean
|
||||
network?: "udp" | "tcp"
|
||||
tls: oTls
|
||||
}
|
||||
|
||||
export interface ShadowTLS extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
version: 1|2|3
|
||||
password?: string
|
||||
tls: oTls
|
||||
}
|
||||
|
||||
export interface VLESS extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
uuid: string
|
||||
flow?: string
|
||||
network?: "udp" | "tcp"
|
||||
packet_encoding?: string
|
||||
tls?: oTls
|
||||
multiplex?: oMultiplex
|
||||
transport?: Transport
|
||||
}
|
||||
|
||||
export interface TUIC extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
uuid: string
|
||||
password?: string
|
||||
congestion_control?: "cubic"|"new_reno"|"bbr"
|
||||
udp_relay_mode?: "native" | "quic"
|
||||
udp_over_stream?: boolean
|
||||
zero_rtt_handshake?: boolean
|
||||
heartbeat?: string
|
||||
network?: "udp" | "tcp"
|
||||
tls: oTls
|
||||
}
|
||||
|
||||
export interface Hysteria2 extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port: number
|
||||
up_mbps?: number
|
||||
down_mbps?: number
|
||||
obfs?: {
|
||||
type?: "salamander"
|
||||
password: string
|
||||
}
|
||||
password?: string
|
||||
network?: "udp" | "tcp"
|
||||
tls: oTls
|
||||
brutal_debug?: boolean
|
||||
}
|
||||
|
||||
export interface Tor extends OutboundBasics, Dial {
|
||||
executable_path?: string
|
||||
extra_args?: string[]
|
||||
data_directory: string
|
||||
torrc?: {
|
||||
ClientOnly: 0 | 1
|
||||
}
|
||||
}
|
||||
|
||||
export interface SSH extends OutboundBasics, Dial {
|
||||
server: string
|
||||
server_port?: number
|
||||
user?: string
|
||||
password?: string
|
||||
private_key?: string
|
||||
private_key_path?: string
|
||||
private_key_passphrase?: string
|
||||
host_key?: string[]
|
||||
host_key_algorithms?: string[]
|
||||
client_version?: string
|
||||
}
|
||||
|
||||
export interface DNS extends OutboundBasics {}
|
||||
|
||||
export interface Selector extends OutboundBasics {
|
||||
outbounds: string[]
|
||||
url?: string
|
||||
interval?: string
|
||||
tolerance?: number
|
||||
idle_timeout?: string
|
||||
interrupt_exist_connections?: boolean
|
||||
}
|
||||
|
||||
export interface URLTest extends OutboundBasics {
|
||||
outbounds: string[]
|
||||
default?: string
|
||||
interrupt_exist_connections?: boolean
|
||||
}
|
||||
|
||||
// Create interfaces dynamically based on OutTypes keys
|
||||
type InterfaceMap = {
|
||||
[Key in keyof typeof OutTypes]: {
|
||||
@@ -64,18 +259,18 @@ export type Outbound = InterfaceMap[keyof InterfaceMap]
|
||||
const defaultValues: Record<OutType, Outbound> = {
|
||||
direct: { type: OutTypes.Direct },
|
||||
block: { type: OutTypes.Block },
|
||||
socks: { type: OutTypes.SOCKS },
|
||||
http: { type: OutTypes.HTTP },
|
||||
shadowsocks: { type: OutTypes.Shadowsocks },
|
||||
vmess: { type: OutTypes.VMess, tls: { enabled: true } },
|
||||
trojan: { type: OutTypes.Trojan },
|
||||
wireguard: { type: OutTypes.Wireguard },
|
||||
hysteria: { type: OutTypes.Hysteria },
|
||||
vless: { type: OutTypes.VLESS },
|
||||
shadowtls: { type: OutTypes.ShadowTLS },
|
||||
tuic: { type: OutTypes.TUIC },
|
||||
hysteria2: { type: OutTypes.Hysteria2, users: [], tls: {} },
|
||||
tur: { type: OutTypes.Tur },
|
||||
socks: { type: OutTypes.SOCKS, version: "5" },
|
||||
http: { type: OutTypes.HTTP, tls: {} },
|
||||
shadowsocks: { type: OutTypes.Shadowsocks, method: 'none', multiplex: {} },
|
||||
vmess: { type: OutTypes.VMess, tls: {}, multiplex: {}, transport: {}, security: 'auto', global_padding: false },
|
||||
trojan: { type: OutTypes.Trojan, tls: {}, multiplex: {}, transport: {} },
|
||||
wireguard: { type: OutTypes.Wireguard, local_address: ['10.0.0.2/32','fe80::2/128'], private_key: '' },
|
||||
hysteria: { type: OutTypes.Hysteria, up_mbps: 100, down_mbps: 100, tls: { enabled: true } },
|
||||
shadowtls: { type: OutTypes.ShadowTLS, version: 3, tls: { enabled: true } },
|
||||
vless: { type: OutTypes.VLESS, tls: {}, multiplex: {}, transport: {} },
|
||||
tuic: { type: OutTypes.TUIC, congestion_control: 'cubic', tls: { enabled: true } },
|
||||
hysteria2: { type: OutTypes.Hysteria2, tls: { enabled: true } },
|
||||
tor: { type: OutTypes.Tor, executable_path: './tor', data_directory: '$HOME/.cache/tor', torrc: { ClientOnly: 1 } },
|
||||
ssh: { type: OutTypes.SSH },
|
||||
dns: { type: OutTypes.DNS },
|
||||
selector: { type: OutTypes.Selector },
|
||||
|
||||
Reference in New Issue
Block a user