mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-03 09:45:54 +00:00
feat: Egern 支持 VLESS REALITY(xtls-rprx-vision). 根据请求的 User-Agent 中的版本号自动开启, 或使用 includeUnsupportedProxy 参数或开启 包含官方/商店版不支持的协议 开关
This commit is contained in:
3 files changed
+59
-41
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.20.19",
|
||||
"version": "2.20.21",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -2,11 +2,10 @@ import { isPresent } from './utils';
|
||||
|
||||
export default function Egern_Producer() {
|
||||
const type = 'ALL';
|
||||
const produce = (proxies, type) => {
|
||||
const produce = (proxies, type, opts = {}) => {
|
||||
// https://egernapp.com/zh-CN/docs/configuration/proxies
|
||||
const list = proxies
|
||||
.filter((proxy) => {
|
||||
// if (opts['include-unsupported-proxy']) return true;
|
||||
if (
|
||||
![
|
||||
'http',
|
||||
@@ -60,8 +59,12 @@ export default function Egern_Producer() {
|
||||
!['http', 'ws', 'tcp'].includes(proxy.network) &&
|
||||
proxy.network) ||
|
||||
(proxy.type === 'vless' &&
|
||||
(typeof proxy.flow !== 'undefined' ||
|
||||
proxy['reality-opts'] ||
|
||||
((!opts['include-unsupported-proxy'] &&
|
||||
(typeof proxy.flow !== 'undefined' ||
|
||||
proxy['reality-opts'])) ||
|
||||
(opts['include-unsupported-proxy'] &&
|
||||
typeof proxy.flow !== 'undefined' &&
|
||||
proxy.flow !== 'xtls-rprx-vision') ||
|
||||
(!['http', 'ws', 'tcp'].includes(proxy.network) &&
|
||||
proxy.network))) ||
|
||||
(proxy.type === 'tuic' &&
|
||||
@@ -74,6 +77,7 @@ export default function Egern_Producer() {
|
||||
})
|
||||
.map((proxy) => {
|
||||
const original = { ...proxy };
|
||||
let flow;
|
||||
if (proxy.tls && !proxy.sni) {
|
||||
proxy.sni = proxy.server;
|
||||
}
|
||||
@@ -312,14 +316,27 @@ export default function Egern_Producer() {
|
||||
},
|
||||
};
|
||||
} else if (proxy.network === 'tcp' || !proxy.network) {
|
||||
let reality;
|
||||
if (
|
||||
proxy['reality-opts']?.['short-id'] ||
|
||||
proxy['reality-opts']?.['public-key']
|
||||
) {
|
||||
reality = {
|
||||
short_id: proxy['reality-opts']['short-id'],
|
||||
public_key: proxy['reality-opts']['public-key'],
|
||||
};
|
||||
}
|
||||
proxy.transport = {
|
||||
[proxy.tls ? 'tls' : 'tcp']: {
|
||||
sni: proxy.tls ? proxy.sni : undefined,
|
||||
skip_tls_verify: proxy.tls
|
||||
? proxy['skip-cert-verify']
|
||||
: undefined,
|
||||
reality,
|
||||
},
|
||||
};
|
||||
|
||||
flow = proxy.flow;
|
||||
}
|
||||
proxy = {
|
||||
type: 'vless',
|
||||
@@ -333,6 +350,7 @@ export default function Egern_Producer() {
|
||||
proxy.udp || proxy.udp_relay || proxy.udp_relay,
|
||||
next_hop: proxy.next_hop,
|
||||
transport: proxy.transport,
|
||||
flow,
|
||||
// sni: proxy.sni,
|
||||
// skip_tls_verify: proxy['skip-cert-verify'],
|
||||
};
|
||||
|
||||
@@ -61,41 +61,41 @@ export function getPlatformFromHeaders(headers) {
|
||||
return getPlatformFromUserAgent({ ua, UA, accept });
|
||||
}
|
||||
export function shouldIncludeUnsupportedProxy(platform, ua) {
|
||||
// try {
|
||||
// const target = getPlatformFromUserAgent({
|
||||
// UA: ua,
|
||||
// ua: ua.toLowerCase(),
|
||||
// });
|
||||
// if (!['Stash', 'Egern', 'Loon'].includes(target)) {
|
||||
// return false;
|
||||
// }
|
||||
// const coerceVersion = coerce(ua);
|
||||
// $.log(JSON.stringify(coerceVersion, null, 2));
|
||||
// const { version } = coerceVersion;
|
||||
// if (
|
||||
// platform === 'Stash' &&
|
||||
// target === 'Stash' &&
|
||||
// gte(version, '3.1.0')
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
// if (
|
||||
// platform === 'Egern' &&
|
||||
// target === 'Egern' &&
|
||||
// gte(version, '1.29.0')
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
// // Loon 的 UA 不规范, version 取出来是 build
|
||||
// if (
|
||||
// platform === 'Loon' &&
|
||||
// target === 'Loon' &&
|
||||
// gte(version, '842.0.0')
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
// } catch (e) {
|
||||
// $.error(`获取版本号失败: ${e}`);
|
||||
// }
|
||||
try {
|
||||
const target = getPlatformFromUserAgent({
|
||||
UA: ua,
|
||||
ua: ua.toLowerCase(),
|
||||
});
|
||||
if (!['Egern'].includes(target)) {
|
||||
return false;
|
||||
}
|
||||
const coerceVersion = coerce(ua);
|
||||
$.log(JSON.stringify(coerceVersion, null, 2));
|
||||
const { version } = coerceVersion;
|
||||
// if (
|
||||
// platform === 'Stash' &&
|
||||
// target === 'Stash' &&
|
||||
// gte(version, '3.1.0')
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
if (
|
||||
platform === 'Egern' &&
|
||||
target === 'Egern' &&
|
||||
gte(version, '2.7.0')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
// Loon 的 UA 不规范, version 取出来是 build
|
||||
// if (
|
||||
// platform === 'Loon' &&
|
||||
// target === 'Loon' &&
|
||||
// gte(version, '842.0.0')
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
} catch (e) {
|
||||
$.error(`获取版本号失败: ${e}`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user