mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-02 09:23:54 +00:00
feat: Egern 支持 WireGuard. 由于 Egern 的请求不带 build 等信息, 无法根据请求判断是否支持来自动开启(与之前不支持的版本号一致都是 2.15.0...). 请使用 includeUnsupportedProxy 参数或开启 包含官方/商店版不支持的协议 开关
This commit is contained in:
2 files changed
+56
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.21.4",
|
||||
"version": "2.21.5",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -17,6 +17,9 @@ export default function Egern_Producer() {
|
||||
'vless',
|
||||
'vmess',
|
||||
'tuic',
|
||||
...(opts['include-unsupported-proxy']
|
||||
? ['wireguard']
|
||||
: []),
|
||||
].includes(proxy.type) ||
|
||||
(proxy.type === 'ss' &&
|
||||
((proxy.plugin === 'obfs' &&
|
||||
@@ -374,6 +377,48 @@ export default function Egern_Producer() {
|
||||
// sni: proxy.sni,
|
||||
// skip_tls_verify: proxy['skip-cert-verify'],
|
||||
};
|
||||
} else if (proxy.type === 'wireguard') {
|
||||
if (Array.isArray(proxy.peers) && proxy.peers.length > 0) {
|
||||
proxy.server = proxy.peers[0].server;
|
||||
proxy.port = proxy.peers[0].port;
|
||||
proxy.ip = proxy.peers[0].ip;
|
||||
proxy.ipv6 = proxy.peers[0].ipv6;
|
||||
proxy['public-key'] = proxy.peers[0]['public-key'];
|
||||
proxy['preshared-key'] =
|
||||
proxy.peers[0]['pre-shared-key'];
|
||||
// https://github.com/MetaCubeX/mihomo/blob/0404e35be8736b695eae018a08debb175c1f96e6/docs/config.yaml#L717
|
||||
proxy['allowed-ips'] = proxy.peers[0]['allowed-ips'];
|
||||
proxy.reserved = proxy.peers[0].reserved;
|
||||
}
|
||||
proxy = {
|
||||
type: 'wireguard',
|
||||
name: proxy.name,
|
||||
local_ipv4: proxy.ip,
|
||||
local_ipv6: proxy.ipv6,
|
||||
server: proxy.server,
|
||||
port: proxy.port,
|
||||
private_key: proxy['private-key'],
|
||||
peer_public_key: proxy['public-key'],
|
||||
preshared_key: proxy['preshared-key'],
|
||||
reserved: proxy.reserved
|
||||
? Array.isArray(proxy.reserved)
|
||||
? proxy.reserved
|
||||
: proxy.reserved
|
||||
.split(/\s*\/\s*/)
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
: undefined,
|
||||
dns_servers: proxy.dns
|
||||
? Array.isArray(proxy.dns)
|
||||
? proxy.dns
|
||||
: proxy.dns
|
||||
.split(/\s*,\s*/)
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
: undefined,
|
||||
mtu: proxy.mtu,
|
||||
keepalive: proxy.keepalive,
|
||||
};
|
||||
}
|
||||
if (
|
||||
[
|
||||
@@ -410,9 +455,16 @@ export default function Egern_Producer() {
|
||||
}
|
||||
}
|
||||
if (
|
||||
['socks5', 'ss', 'trojan', 'vless', 'vmess'].includes(
|
||||
original.type,
|
||||
)
|
||||
[
|
||||
'socks5',
|
||||
'ss',
|
||||
'trojan',
|
||||
'vless',
|
||||
'vmess',
|
||||
'wireguard',
|
||||
'tuic',
|
||||
'hysteria2',
|
||||
].includes(original.type)
|
||||
) {
|
||||
if (
|
||||
['on', 'true', true, '1', 1].includes(
|
||||
|
||||
Reference in new issue
Block a user