mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
fix: correct know issues
This commit is contained in:
parent
78370717df
commit
94ecd10704
@ -43,6 +43,7 @@ class ClashMeta implements ProtocolInterface
|
||||
$proxies = [];
|
||||
|
||||
foreach ($servers as $item) {
|
||||
$protocol_settings = $item['protocol_settings'];
|
||||
if ($item['type'] === 'shadowsocks') {
|
||||
array_push($proxy, self::buildShadowsocks($item['password'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
@ -55,7 +56,10 @@ class ClashMeta implements ProtocolInterface
|
||||
array_push($proxy, self::buildTrojan($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
if ($item['type'] === 'vless') {
|
||||
if (
|
||||
$item['type'] === 'vless'
|
||||
&& in_array(data_get($protocol_settings, 'network'), ['tcp', 'ws', 'grpc', 'http', 'h2'])
|
||||
) {
|
||||
array_push($proxy, self::buildVless($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class SingBox implements ProtocolInterface
|
||||
$outbounds = $this->config['outbounds'];
|
||||
$proxies = [];
|
||||
foreach ($this->servers as $item) {
|
||||
$protocol_settings = $item['protocol_settings'];
|
||||
if ($item['type'] === 'shadowsocks') {
|
||||
$ssConfig = $this->buildShadowsocks($item['password'], $item);
|
||||
$proxies[] = $ssConfig;
|
||||
@ -63,7 +64,9 @@ class SingBox implements ProtocolInterface
|
||||
$vmessConfig = $this->buildVmess($this->user['uuid'], $item);
|
||||
$proxies[] = $vmessConfig;
|
||||
}
|
||||
if ($item['type'] === 'vless') {
|
||||
if ($item['type'] === 'vless'
|
||||
&& in_array(data_get($protocol_settings, 'network'), ['tcp', 'ws', 'grpc', 'http', 'quic', 'httpupgrade'])
|
||||
) {
|
||||
$vlessConfig = $this->buildVless($this->user['uuid'], $item);
|
||||
$proxies[] = $vlessConfig;
|
||||
}
|
||||
@ -213,13 +216,13 @@ class SingBox implements ProtocolInterface
|
||||
],
|
||||
'h2' => [
|
||||
'type' => 'http',
|
||||
'host' => data_get($protocol_settings, 'network_settings.host') ? [data_get($protocol_settings, 'network_settings.host')] : null,
|
||||
'host' => data_get($protocol_settings, 'network_settings.host'),
|
||||
'path' => data_get($protocol_settings, 'network_settings.path')
|
||||
],
|
||||
'httpupgrade' => [
|
||||
'type' => 'httpupgrade',
|
||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
||||
'host' => data_get($protocol_settings, 'network_settings.headers.Host', $server['host']),
|
||||
'host' => data_get($protocol_settings, 'network_settings.host', $server['host']),
|
||||
'headers' => data_get($protocol_settings, 'network_settings.headers')
|
||||
],
|
||||
default => null
|
||||
|
@ -59,10 +59,15 @@ class Stash implements ProtocolInterface
|
||||
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
// if ($item['type'] === 'vless') {
|
||||
// array_push($proxy, self::buildVless($user['uuid'], $item));
|
||||
// array_push($proxies, $item['name']);
|
||||
// }
|
||||
if (
|
||||
$item['type'] === 'vless'
|
||||
&& in_array(data_get($item['protocol_settings'], 'network'), ['tcp', 'ws', 'grpc', 'http', 'h2'])
|
||||
&& in_array(data_get($item['protocol_settings'], 'tls'), [1, 0])
|
||||
&& in_array(data_get($item['protocol_settings'], 'flow'), ['xtls-rprx-origin', 'xtls-rprx-direct', 'xtls-rprx-splice'])
|
||||
) {
|
||||
array_push($proxy, self::buildVless($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
if ($item['type'] === 'hysteria') {
|
||||
array_push($proxy, self::buildHysteria($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
@ -192,15 +197,6 @@ class Stash implements ProtocolInterface
|
||||
$array['servername'] = $serverName;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$array['tls'] = true;
|
||||
$array['skip-cert-verify'] = data_get($protocol_settings, 'reality_settings.allow_insecure');
|
||||
$array['servername'] = data_get($protocol_settings, 'reality_settings.server_name');
|
||||
$array['reality-opts'] = [
|
||||
'public-key' => data_get($protocol_settings, 'reality_settings.public_key'),
|
||||
'short-id' => data_get($protocol_settings, 'reality_settings.short_id')
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
@ -219,6 +215,11 @@ class Stash implements ProtocolInterface
|
||||
$array['network'] = 'grpc';
|
||||
$array['grpc-opts']['grpc-service-name'] = data_get($protocol_settings, 'network_settings.serviceName');
|
||||
break;
|
||||
// case 'h2':
|
||||
// $array['network'] = 'h2';
|
||||
// $array['h2-opts']['host'] = data_get($protocol_settings, 'network_settings.host');
|
||||
// $array['h2-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||
// break;
|
||||
}
|
||||
|
||||
return $array;
|
||||
|
@ -42,27 +42,19 @@ class Surge implements ProtocolInterface
|
||||
'chacha20-ietf-poly1305'
|
||||
])
|
||||
) {
|
||||
// [Proxy]
|
||||
$proxies .= self::buildShadowsocks($item['password'], $item);
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
if ($item['type'] === 'vmess') {
|
||||
// [Proxy]
|
||||
$proxies .= self::buildVmess($user['uuid'], $item);
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
if ($item['type'] === 'trojan') {
|
||||
// [Proxy]
|
||||
$proxies .= self::buildTrojan($user['uuid'], $item);
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
if ($item['type'] === 'hysteria') {
|
||||
// [Proxy]
|
||||
$proxies .= self::buildHysteria($user['uuid'], $item);
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user