mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-28 16:09:36 +00:00
refactor(frontend): swap InboundFormModal option dicts to schemas/primitives
Extends primitives/options.ts with the five inbound-only option dicts (TLS_VERSION_OPTION, TLS_CIPHER_OPTION, USAGE_OPTION, DOMAIN_STRATEGY_OPTION, TCP_CONGESTION_OPTION) and lifts InboundFormModal off @/models/inbound for 10 of its 12 imports. Only the Inbound class and SSMethods (inbound vs outbound versions diverge by 2 entries) still come from @/models/. Widens NODE_ELIGIBLE_PROTOCOLS Set element type to string since the new primitives const exposes a narrow literal union that `.has(arbitraryString)` would otherwise reject.
This commit is contained in:
@@ -41,10 +41,9 @@ import {
|
||||
} from '@/utils';
|
||||
import InputAddon from '@/components/InputAddon';
|
||||
import { getRandomRealityTarget } from '@/models/reality-targets';
|
||||
import { Inbound, SSMethods } from '@/models/inbound';
|
||||
import {
|
||||
Inbound,
|
||||
Protocols,
|
||||
SSMethods,
|
||||
SNIFFING_OPTION,
|
||||
TLS_VERSION_OPTION,
|
||||
TLS_CIPHER_OPTION,
|
||||
@@ -54,7 +53,7 @@ import {
|
||||
DOMAIN_STRATEGY_OPTION,
|
||||
TCP_CONGESTION_OPTION,
|
||||
MODE_OPTION,
|
||||
} from '@/models/inbound';
|
||||
} from '@/schemas/primitives';
|
||||
import { DBInbound } from '@/models/dbinbound';
|
||||
import FinalMaskForm from '@/components/FinalMaskForm';
|
||||
import DateTimePicker from '@/components/DateTimePicker';
|
||||
@@ -151,7 +150,7 @@ const DOMAIN_STRATEGIES = Object.values(DOMAIN_STRATEGY_OPTION) as string[];
|
||||
const TCP_CONGESTIONS = Object.values(TCP_CONGESTION_OPTION) as string[];
|
||||
const MODE_OPTIONS = Object.values(MODE_OPTION) as string[];
|
||||
|
||||
const NODE_ELIGIBLE_PROTOCOLS = new Set([
|
||||
const NODE_ELIGIBLE_PROTOCOLS = new Set<string>([
|
||||
Protocols.VLESS,
|
||||
Protocols.VMESS,
|
||||
Protocols.TROJAN,
|
||||
|
||||
@@ -60,3 +60,52 @@ export const Address_Port_Strategy = Object.freeze({
|
||||
});
|
||||
|
||||
export const DNSRuleActions = Object.freeze(['direct', 'drop', 'reject', 'hijack'] as const);
|
||||
|
||||
export const TLS_VERSION_OPTION = Object.freeze({
|
||||
TLS10: '1.0',
|
||||
TLS11: '1.1',
|
||||
TLS12: '1.2',
|
||||
TLS13: '1.3',
|
||||
});
|
||||
|
||||
export const TLS_CIPHER_OPTION = Object.freeze({
|
||||
AES_128_GCM: 'TLS_AES_128_GCM_SHA256',
|
||||
AES_256_GCM: 'TLS_AES_256_GCM_SHA384',
|
||||
CHACHA20_POLY1305: 'TLS_CHACHA20_POLY1305_SHA256',
|
||||
ECDHE_ECDSA_AES_128_CBC: 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA',
|
||||
ECDHE_ECDSA_AES_256_CBC: 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA',
|
||||
ECDHE_RSA_AES_128_CBC: 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA',
|
||||
ECDHE_RSA_AES_256_CBC: 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA',
|
||||
ECDHE_ECDSA_AES_128_GCM: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
||||
ECDHE_ECDSA_AES_256_GCM: 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
|
||||
ECDHE_RSA_AES_128_GCM: 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256',
|
||||
ECDHE_RSA_AES_256_GCM: 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
|
||||
ECDHE_ECDSA_CHACHA20_POLY1305: 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256',
|
||||
ECDHE_RSA_CHACHA20_POLY1305: 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256',
|
||||
});
|
||||
|
||||
export const USAGE_OPTION = Object.freeze({
|
||||
ENCIPHERMENT: 'encipherment',
|
||||
VERIFY: 'verify',
|
||||
ISSUE: 'issue',
|
||||
});
|
||||
|
||||
export const DOMAIN_STRATEGY_OPTION = Object.freeze({
|
||||
AS_IS: 'AsIs',
|
||||
USE_IP: 'UseIP',
|
||||
USE_IPV6V4: 'UseIPv6v4',
|
||||
USE_IPV6: 'UseIPv6',
|
||||
USE_IPV4V6: 'UseIPv4v6',
|
||||
USE_IPV4: 'UseIPv4',
|
||||
FORCE_IP: 'ForceIP',
|
||||
FORCE_IPV6V4: 'ForceIPv6v4',
|
||||
FORCE_IPV6: 'ForceIPv6',
|
||||
FORCE_IPV4V6: 'ForceIPv4v6',
|
||||
FORCE_IPV4: 'ForceIPv4',
|
||||
});
|
||||
|
||||
export const TCP_CONGESTION_OPTION = Object.freeze({
|
||||
BBR: 'bbr',
|
||||
CUBIC: 'cubic',
|
||||
RENO: 'reno',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user