feat(tls-fingerprint): 新增 TLS 指纹 Profile 数据库管理及代码质量优化
新增功能: - 新增 TLS 指纹 Profile CRUD 管理(Ent schema + 迁移 + Admin API + 前端管理界面) - 支持账号绑定数据库中的自定义 TLS Profile,或随机选择(profile_id=-1) - HTTPUpstream.DoWithTLS 接口从 bool 改为 *tlsfingerprint.Profile,支持按账号指定 Profile - AccountUsageService 注入 TLSFingerprintProfileService,统一 usage 场景与网关的 Profile 解析逻辑 代码优化: - 删除已被 TLSFingerprintProfileService 完全取代的 registry.go 死代码(418 行) - 提取 3 个 dialer 的重复 TLS 握手逻辑为 performTLSHandshake() 共用函数 - 修复 GetTLSFingerprintProfileID 缺少 json.Number 处理的 bug - gateway_service.Forward 中 ResolveTLSProfile 从重试循环内重复调用改为预解析局部变量 - 删除冗余的 buildClientHelloSpec() 单行 wrapper 和 int64(e.ID) 无效转换 - tls_fingerprint_profile_cache.go 日志从 log.Printf 改为 slog 结构化日志 - dialer_capture_test.go 添加 //go:build integration 标签,防止 CI 失败 - 去重 TestProfileExpectation 类型至共享 test_types_test.go - 修复 9 个测试文件缺少 tlsfingerprint import 的编译错误 - 修复 error_policy_integration_test.go 中 handleError 回调签名被错误替换的问题
This commit is contained in:
@@ -2304,7 +2304,9 @@ export default {
|
||||
},
|
||||
tlsFingerprint: {
|
||||
label: 'TLS Fingerprint Simulation',
|
||||
hint: 'Simulate Node.js/Claude Code client TLS fingerprint'
|
||||
hint: 'Simulate Node.js/Claude Code client TLS fingerprint',
|
||||
defaultProfile: 'Built-in Default',
|
||||
randomProfile: 'Random'
|
||||
},
|
||||
sessionIdMasking: {
|
||||
label: 'Session ID Masking',
|
||||
@@ -4588,6 +4590,62 @@ export default {
|
||||
failedToSave: 'Failed to save rule',
|
||||
failedToDelete: 'Failed to delete rule',
|
||||
failedToToggle: 'Failed to toggle status'
|
||||
},
|
||||
|
||||
// TLS Fingerprint Profiles
|
||||
tlsFingerprintProfiles: {
|
||||
title: 'TLS Fingerprint Profiles',
|
||||
description: 'Manage TLS fingerprint profiles for simulating specific client TLS handshake characteristics',
|
||||
createProfile: 'Create Profile',
|
||||
editProfile: 'Edit Profile',
|
||||
deleteProfile: 'Delete Profile',
|
||||
noProfiles: 'No profiles configured',
|
||||
createFirstProfile: 'Create your first TLS fingerprint profile',
|
||||
|
||||
columns: {
|
||||
name: 'Name',
|
||||
description: 'Description',
|
||||
grease: 'GREASE',
|
||||
alpn: 'ALPN',
|
||||
actions: 'Actions'
|
||||
},
|
||||
|
||||
form: {
|
||||
pasteYaml: 'Paste YAML Configuration',
|
||||
pasteYamlPlaceholder: 'Paste YAML output from TLS Fingerprint Collector here...',
|
||||
pasteYamlHint: 'Paste the YAML copied from TLS Fingerprint Collector to auto-fill all fields.',
|
||||
openCollector: 'Open Collector',
|
||||
parseYaml: 'Parse YAML',
|
||||
yamlParsed: 'YAML parsed successfully, fields auto-filled',
|
||||
yamlParseFailed: 'Failed to parse YAML: name field not found',
|
||||
name: 'Profile Name',
|
||||
namePlaceholder: 'e.g. macOS Node.js v24',
|
||||
description: 'Description',
|
||||
descriptionPlaceholder: 'Optional description for this profile',
|
||||
enableGrease: 'Enable GREASE',
|
||||
enableGreaseHint: 'Insert GREASE values in TLS ClientHello extensions',
|
||||
cipherSuites: 'Cipher Suites',
|
||||
cipherSuitesHint: 'Comma-separated hex values, e.g. 0x1301, 0x1302, 0xc02c',
|
||||
curves: 'Elliptic Curves',
|
||||
curvesHint: 'Comma-separated curve IDs',
|
||||
pointFormats: 'Point Formats',
|
||||
signatureAlgorithms: 'Signature Algorithms',
|
||||
alpnProtocols: 'ALPN Protocols',
|
||||
alpnProtocolsHint: 'Comma-separated, e.g. h2, http/1.1',
|
||||
supportedVersions: 'Supported TLS Versions',
|
||||
keyShareGroups: 'Key Share Groups',
|
||||
pskModes: 'PSK Modes',
|
||||
extensions: 'Extensions'
|
||||
},
|
||||
|
||||
deleteConfirm: 'Delete Profile',
|
||||
deleteConfirmMessage: 'Are you sure you want to delete profile "{name}"? Accounts using this profile will fall back to the built-in default.',
|
||||
createSuccess: 'Profile created successfully',
|
||||
updateSuccess: 'Profile updated successfully',
|
||||
deleteSuccess: 'Profile deleted successfully',
|
||||
loadFailed: 'Failed to load profiles',
|
||||
saveFailed: 'Failed to save profile',
|
||||
deleteFailed: 'Failed to delete profile'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -2448,7 +2448,9 @@ export default {
|
||||
},
|
||||
tlsFingerprint: {
|
||||
label: 'TLS 指纹模拟',
|
||||
hint: '模拟 Node.js/Claude Code 客户端的 TLS 指纹'
|
||||
hint: '模拟 Node.js/Claude Code 客户端的 TLS 指纹',
|
||||
defaultProfile: '内置默认',
|
||||
randomProfile: '随机'
|
||||
},
|
||||
sessionIdMasking: {
|
||||
label: '会话 ID 伪装',
|
||||
@@ -4752,6 +4754,62 @@ export default {
|
||||
failedToSave: '保存规则失败',
|
||||
failedToDelete: '删除规则失败',
|
||||
failedToToggle: '切换状态失败'
|
||||
},
|
||||
|
||||
// TLS 指纹模板
|
||||
tlsFingerprintProfiles: {
|
||||
title: 'TLS 指纹模板',
|
||||
description: '管理 TLS 指纹模板,用于模拟特定客户端的 TLS 握手特征',
|
||||
createProfile: '创建模板',
|
||||
editProfile: '编辑模板',
|
||||
deleteProfile: '删除模板',
|
||||
noProfiles: '暂无模板',
|
||||
createFirstProfile: '创建你的第一个 TLS 指纹模板',
|
||||
|
||||
columns: {
|
||||
name: '名称',
|
||||
description: '描述',
|
||||
grease: 'GREASE',
|
||||
alpn: 'ALPN',
|
||||
actions: '操作'
|
||||
},
|
||||
|
||||
form: {
|
||||
pasteYaml: '粘贴 YAML 配置',
|
||||
pasteYamlPlaceholder: '将 TLS 指纹采集器复制的 YAML 粘贴到这里...',
|
||||
pasteYamlHint: '粘贴从 TLS 指纹采集器复制的 YAML 配置,自动填充所有字段。',
|
||||
openCollector: '打开采集器',
|
||||
parseYaml: '解析 YAML',
|
||||
yamlParsed: 'YAML 解析成功,字段已自动填充',
|
||||
yamlParseFailed: 'YAML 解析失败:未找到 name 字段',
|
||||
name: '模板名称',
|
||||
namePlaceholder: '例如 macOS Node.js v24',
|
||||
description: '描述',
|
||||
descriptionPlaceholder: '可选的模板描述',
|
||||
enableGrease: '启用 GREASE',
|
||||
enableGreaseHint: '在 TLS ClientHello 扩展中插入 GREASE 值',
|
||||
cipherSuites: '密码套件',
|
||||
cipherSuitesHint: '逗号分隔的十六进制值,例如 0x1301, 0x1302, 0xc02c',
|
||||
curves: '椭圆曲线',
|
||||
curvesHint: '逗号分隔的曲线 ID',
|
||||
pointFormats: '点格式',
|
||||
signatureAlgorithms: '签名算法',
|
||||
alpnProtocols: 'ALPN 协议',
|
||||
alpnProtocolsHint: '逗号分隔,例如 h2, http/1.1',
|
||||
supportedVersions: '支持的 TLS 版本',
|
||||
keyShareGroups: '密钥共享组',
|
||||
pskModes: 'PSK 模式',
|
||||
extensions: '扩展'
|
||||
},
|
||||
|
||||
deleteConfirm: '删除模板',
|
||||
deleteConfirmMessage: '确定要删除模板 "{name}" 吗?使用此模板的账号将回退到内置默认值。',
|
||||
createSuccess: '模板创建成功',
|
||||
updateSuccess: '模板更新成功',
|
||||
deleteSuccess: '模板删除成功',
|
||||
loadFailed: '加载模板失败',
|
||||
saveFailed: '保存模板失败',
|
||||
deleteFailed: '删除模板失败'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user