mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-14 03:35:55 +08:00
fix: 修复传输层和 SNI 的问题(有问题麻烦即时反馈 谢谢)
This commit is contained in:
parent
a2e45bcb10
commit
839fcacf63
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.397",
|
"version": "2.14.398",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -408,20 +408,7 @@ function lastParse(proxy) {
|
|||||||
proxy['h2-opts'].path = path[0];
|
proxy['h2-opts'].path = path[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (proxy.tls && !proxy.sni) {
|
|
||||||
if (proxy.network) {
|
|
||||||
let transportHost = proxy[`${proxy.network}-opts`]?.headers?.Host;
|
|
||||||
transportHost = Array.isArray(transportHost)
|
|
||||||
? transportHost[0]
|
|
||||||
: transportHost;
|
|
||||||
if (transportHost) {
|
|
||||||
proxy.sni = transportHost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!proxy.sni && !isIP(proxy.server)) {
|
|
||||||
proxy.sni = proxy.server;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 非 tls, 有 ws/http 传输层, 使用域名的节点, 将设置传输层 Host 防止之后域名解析后丢失域名(不覆盖现有的 Host)
|
// 非 tls, 有 ws/http 传输层, 使用域名的节点, 将设置传输层 Host 防止之后域名解析后丢失域名(不覆盖现有的 Host)
|
||||||
if (
|
if (
|
||||||
!proxy.tls &&
|
!proxy.tls &&
|
||||||
@ -448,6 +435,20 @@ function lastParse(proxy) {
|
|||||||
proxy[`${proxy.network}-opts`].path = [transportPath];
|
proxy[`${proxy.network}-opts`].path = [transportPath];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (proxy.tls && !proxy.sni) {
|
||||||
|
if (!isIP(proxy.server)) {
|
||||||
|
proxy.sni = proxy.server;
|
||||||
|
}
|
||||||
|
if (!proxy.sni && proxy.network) {
|
||||||
|
let transportHost = proxy[`${proxy.network}-opts`]?.headers?.Host;
|
||||||
|
transportHost = Array.isArray(transportHost)
|
||||||
|
? transportHost[0]
|
||||||
|
: transportHost;
|
||||||
|
if (transportHost) {
|
||||||
|
proxy.sni = transportHost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// if (['hysteria', 'hysteria2', 'tuic'].includes(proxy.type)) {
|
// if (['hysteria', 'hysteria2', 'tuic'].includes(proxy.type)) {
|
||||||
if (proxy.ports) {
|
if (proxy.ports) {
|
||||||
proxy.ports = String(proxy.ports).replace(/\//g, ',');
|
proxy.ports = String(proxy.ports).replace(/\//g, ',');
|
||||||
|
@ -391,12 +391,6 @@ function URI_VMess() {
|
|||||||
} else {
|
} else {
|
||||||
delete proxy.network;
|
delete proxy.network;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/MetaCubeX/Clash.Meta/blob/Alpha/docs/config.yaml#L413
|
|
||||||
// sni 优先级应高于 host
|
|
||||||
if (proxy.tls && !proxy.sni && transportHost) {
|
|
||||||
proxy.sni = transportHost;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
@ -539,15 +533,6 @@ function URI_VLESS() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proxy.tls && !proxy.sni) {
|
|
||||||
if (proxy.network === 'ws') {
|
|
||||||
proxy.sni = proxy['ws-opts']?.headers?.Host;
|
|
||||||
} else if (proxy.network === 'http') {
|
|
||||||
let httpHost = proxy['http-opts']?.headers?.Host;
|
|
||||||
proxy.sni = Array.isArray(httpHost) ? httpHost[0] : httpHost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
};
|
};
|
||||||
return { name, test, parse };
|
return { name, test, parse };
|
||||||
@ -894,22 +879,6 @@ function Clash_All() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle vmess sni
|
|
||||||
if (['vmess', 'vless'].includes(proxy.type)) {
|
|
||||||
proxy.sni = proxy.servername;
|
|
||||||
delete proxy.servername;
|
|
||||||
if (proxy.tls && !proxy.sni) {
|
|
||||||
if (proxy.network === 'ws') {
|
|
||||||
proxy.sni = proxy['ws-opts']?.headers?.Host;
|
|
||||||
} else if (proxy.network === 'http') {
|
|
||||||
let httpHost = proxy['http-opts']?.headers?.Host;
|
|
||||||
proxy.sni = Array.isArray(httpHost)
|
|
||||||
? httpHost[0]
|
|
||||||
: httpHost;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (proxy['server-cert-fingerprint']) {
|
if (proxy['server-cert-fingerprint']) {
|
||||||
proxy['tls-fingerprint'] = proxy['server-cert-fingerprint'];
|
proxy['tls-fingerprint'] = proxy['server-cert-fingerprint'];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user