feat(proxy): 统一代理配置并支持 SOCKS5H 协议
- 新增 proxyutil 包,统一 HTTP/HTTPS/SOCKS5/SOCKS5H 代理配置逻辑 - SOCKS5H 支持服务端 DNS 解析,避免本地 DNS 泄露 - 移除 ProxyStrict 宽松模式,代理失败直接返回错误不回退直连 - 前端代理管理页面支持 SOCKS5H 协议的添加/编辑/批量导入 - 补充 IPv6 地址和特殊字符密码的边界测试
This commit is contained in:
@@ -290,7 +290,7 @@ export interface UpdateGroupRequest {
|
||||
export type AccountPlatform = 'anthropic' | 'openai' | 'gemini' | 'antigravity'
|
||||
export type AccountType = 'oauth' | 'setup-token' | 'apikey'
|
||||
export type OAuthAddMethod = 'oauth' | 'setup-token'
|
||||
export type ProxyProtocol = 'http' | 'https' | 'socks5'
|
||||
export type ProxyProtocol = 'http' | 'https' | 'socks5' | 'socks5h'
|
||||
|
||||
// Claude Model type (returned by /v1/models and account models API)
|
||||
export interface ClaudeModel {
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<template #cell-protocol="{ value }">
|
||||
<span
|
||||
v-if="value"
|
||||
:class="['badge', value === 'socks5' ? 'badge-primary' : 'badge-gray']"
|
||||
:class="['badge', value.startsWith('socks5') ? 'badge-primary' : 'badge-gray']"
|
||||
>
|
||||
{{ value.toUpperCase() }}
|
||||
</span>
|
||||
@@ -628,7 +628,8 @@ const protocolOptions = computed(() => [
|
||||
{ value: '', label: t('admin.proxies.allProtocols') },
|
||||
{ value: 'http', label: 'HTTP' },
|
||||
{ value: 'https', label: 'HTTPS' },
|
||||
{ value: 'socks5', label: 'SOCKS5' }
|
||||
{ value: 'socks5', label: 'SOCKS5' },
|
||||
{ value: 'socks5h', label: 'SOCKS5H' }
|
||||
])
|
||||
|
||||
const statusOptions = computed(() => [
|
||||
@@ -641,7 +642,8 @@ const statusOptions = computed(() => [
|
||||
const protocolSelectOptions = [
|
||||
{ value: 'http', label: 'HTTP' },
|
||||
{ value: 'https', label: 'HTTPS' },
|
||||
{ value: 'socks5', label: 'SOCKS5' }
|
||||
{ value: 'socks5', label: 'SOCKS5' },
|
||||
{ value: 'socks5h', label: 'SOCKS5H (服务端解析DNS)' }
|
||||
]
|
||||
|
||||
const editStatusOptions = computed(() => [
|
||||
@@ -798,8 +800,8 @@ const parseProxyUrl = (
|
||||
const trimmed = line.trim()
|
||||
if (!trimmed) return null
|
||||
|
||||
// Regex to parse proxy URL
|
||||
const regex = /^(https?|socks5):\/\/(?:([^:@]+):([^@]+)@)?([^:]+):(\d+)$/i
|
||||
// Regex to parse proxy URL (supports http, https, socks5, socks5h)
|
||||
const regex = /^(https?|socks5h?):\/\/(?:([^:@]+):([^@]+)@)?([^:]+):(\d+)$/i
|
||||
const match = trimmed.match(regex)
|
||||
|
||||
if (!match) return null
|
||||
|
||||
Reference in New Issue
Block a user