🐛 fix: Update protocol fields to use 'obfs' instead of 'security' and adjust related configurations

This commit is contained in:
web
2025-09-28 06:57:41 -07:00
parent fc43de16f0
commit 4abdd367ee
15 changed files with 164 additions and 64 deletions
@@ -10,9 +10,9 @@ export function getProtocolDefaultConfig(proto: ProtocolType) {
port: null,
cipher: 'chacha20-ietf-poly1305',
server_key: null,
security: 'none',
host: null,
path: null,
obfs: 'none',
obfs_host: null,
obfs_path: null,
sni: null,
allow_insecure: null,
cert_mode: 'none',
@@ -65,42 +65,42 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
].includes(p.cipher),
},
{
name: 'security',
name: 'obfs',
type: 'select',
label: 'security',
options: SECURITY.shadowsocks,
label: 'obfs',
options: ['none', 'http', 'tls'],
defaultValue: 'none',
group: 'security',
group: 'obfs',
},
{
name: 'host',
name: 'obfs_host',
type: 'input',
label: 'host',
placeholder: 'e.g. www.bing.com',
group: 'security',
condition: (p) => p.security && p.security !== 'none',
group: 'obfs',
condition: (p) => p.obfs && p.obfs !== 'none',
},
{
name: 'path',
name: 'obfs_path',
type: 'input',
label: 'path',
placeholder: 'e.g. /path/to/obfs',
group: 'security',
condition: (p) => p.security && p.security !== 'none',
group: 'obfs',
condition: (p) => p.obfs && p.obfs !== 'none',
},
{
name: 'sni',
type: 'input',
label: 'security_sni',
group: 'security',
condition: (p) => p.security === 'tls',
condition: (p) => p.obfs === 'tls',
},
{
name: 'allow_insecure',
type: 'switch',
label: 'security_allow_insecure',
group: 'security',
condition: (p) => p.security === 'tls',
condition: (p) => p.obfs === 'tls',
},
{
name: 'cert_mode',
@@ -109,7 +109,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
options: CERT_MODES,
defaultValue: 'none',
group: 'security',
condition: (p) => p.security === 'tls',
condition: (p) => p.obfs === 'tls',
},
{
name: 'cert_dns_provider',
@@ -117,7 +117,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
label: 'cert_dns_provider',
placeholder: 'e.g. cloudflare, aliyun',
group: 'security',
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
condition: (p) => p.obfs === 'tls' && p.cert_mode === 'dns',
},
{
name: 'cert_dns_env',
@@ -126,7 +126,7 @@ export const PROTOCOL_FIELDS: Record<string, FieldConfig[]> = {
placeholder:
'CF_DNS_API_TOKEN=1234567890abcdefghijklmnopqrstuvwxyz\nALI_ACCESS_KEY_ID=your_access_key_id\nALI_ACCESS_KEY_SECRET=your_access_key_secret',
group: 'security',
condition: (p) => p.security === 'tls' && p.cert_mode === 'dns',
condition: (p) => p.obfs === 'tls' && p.cert_mode === 'dns',
},
],
vmess: [
@@ -26,9 +26,9 @@ const ss = z.object({
port: nullablePort,
cipher: z.enum(SS_CIPHERS).nullish(),
server_key: nullableString,
security: z.enum(SECURITY.shadowsocks).nullish(),
host: nullableString,
path: nullableString,
obfs: z.enum(['none', 'http', 'tls'] as const).nullish(),
obfs_host: nullableString,
obfs_path: nullableString,
cert_mode: z.enum(CERT_MODES).nullish(),
cert_dns_provider: nullableString,
cert_dns_env: nullableString,