mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
fix: correct know file issues
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
Some checks are pending
Docker Build and Publish / build (push) Waiting to run
This commit is contained in:
parent
efe8c2a96d
commit
1926d6a867
@ -153,7 +153,9 @@ class Clash implements ProtocolInterface
|
||||
if (data_get($protocol_settings, 'tls')) {
|
||||
$array['tls'] = true;
|
||||
$array['skip-cert-verify'] = (bool) data_get($protocol_settings, 'tls_settings.allow_insecure');
|
||||
$array['servername'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['servername'] = $serverName;
|
||||
}
|
||||
}
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
@ -193,7 +195,9 @@ class Clash implements ProtocolInterface
|
||||
$array['port'] = $server['port'];
|
||||
$array['password'] = $password;
|
||||
$array['udp'] = true;
|
||||
$array['sni'] = data_get($protocol_settings, 'server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'server_name')) {
|
||||
$array['sni'] = $serverName;
|
||||
}
|
||||
$array['skip-cert-verify'] = (bool) data_get($protocol_settings, 'allow_insecure');
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
|
@ -204,7 +204,9 @@ class ClashMeta implements ProtocolInterface
|
||||
case 1:
|
||||
$array['tls'] = true;
|
||||
$array['skip-cert-verify'] = (bool) data_get($protocol_settings, 'tls_settings.allow_insecure', false);
|
||||
$array['servername'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['servername'] = $serverName;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$array['tls'] = true;
|
||||
@ -258,9 +260,11 @@ class ClashMeta implements ProtocolInterface
|
||||
'port' => $server['port'],
|
||||
'password' => $password,
|
||||
'udp' => true,
|
||||
'sni' => data_get($protocol_settings, 'server_name'),
|
||||
'skip-cert-verify' => (bool) data_get($protocol_settings, 'allow_insecure', false)
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'server_name')) {
|
||||
$array['sni'] = $serverName;
|
||||
}
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'grpc':
|
||||
|
@ -77,8 +77,10 @@ class General implements ProtocolInterface
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $protocol_settings['tls'] ? "tls" : "",
|
||||
"sni" => data_get($protocol_settings, 'tls_settings.server_name'),
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$config['sni'] = $serverName;
|
||||
}
|
||||
|
||||
switch ($protocol_settings['network']) {
|
||||
case 'tcp':
|
||||
@ -123,7 +125,9 @@ class General implements ProtocolInterface
|
||||
switch ($server['protocol_settings']['tls']) {
|
||||
case 1:
|
||||
$config['security'] = "tls";
|
||||
$config['sni'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$config['sni'] = $serverName;
|
||||
}
|
||||
break;
|
||||
case 2: //reality
|
||||
$config['security'] = "reality";
|
||||
@ -175,11 +179,13 @@ class General implements ProtocolInterface
|
||||
{
|
||||
$protocol_settings = $server['protocol_settings'];
|
||||
$name = rawurlencode($server['name']);
|
||||
$query = http_build_query([
|
||||
'allowInsecure' => $protocol_settings['allow_insecure'],
|
||||
'peer' => $protocol_settings['server_name'],
|
||||
'sni' => $protocol_settings['server_name']
|
||||
]);
|
||||
$array = [];
|
||||
$array['allowInsecure'] = $protocol_settings['allow_insecure'];
|
||||
if ($serverName = data_get($protocol_settings, 'server_name')) {
|
||||
$array['peer'] = $serverName;
|
||||
$array['sni'] = $serverName;
|
||||
}
|
||||
$query = http_build_query($array);
|
||||
$uri = "trojan://{$password}@{$server['host']}:{$server['port']}?{$query}#{$name}";
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
@ -194,8 +200,8 @@ class General implements ProtocolInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
if (data_get($protocol_settings, 'tls.server_name')) {
|
||||
$params['sni'] = data_get($protocol_settings, 'tls.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$params['sni'] = $serverName;
|
||||
$params['security'] = 'tls';
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ class Loon implements ProtocolInterface
|
||||
'fast-open=false',
|
||||
'udp=true'
|
||||
];
|
||||
if (!empty($server['allow_insecure'])) {
|
||||
if (!empty($protocol_settings['allow_insecure'])) {
|
||||
array_push($config, data_get($protocol_settings, 'tls_settings')['allow_insecure'] ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||
}
|
||||
$config = array_filter($config);
|
||||
|
@ -145,7 +145,9 @@ class Shadowrocket implements ProtocolInterface
|
||||
case 1:
|
||||
$config['tls'] = 1;
|
||||
$config['allowInsecure'] = (int) data_get($protocol_settings, 'tls_settings.allow_insecure');
|
||||
$config['peer'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$config['peer'] = $serverName;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$config['tls'] = 1;
|
||||
@ -187,10 +189,10 @@ class Shadowrocket implements ProtocolInterface
|
||||
{
|
||||
$protocol_settings = $server['protocol_settings'];
|
||||
$name = rawurlencode($server['name']);
|
||||
$params = [
|
||||
'allowInsecure' => data_get($protocol_settings, 'tls.allow_insecure'),
|
||||
'peer' => data_get($protocol_settings, 'tls.server_name')
|
||||
];
|
||||
$params['allowInsecure'] = data_get($protocol_settings, 'tls.allow_insecure');
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$params['peer'] = $serverName;
|
||||
}
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'grpc':
|
||||
$params['obfs'] = 'grpc';
|
||||
@ -218,9 +220,11 @@ class Shadowrocket implements ProtocolInterface
|
||||
"upmbps" => data_get($protocol_settings, 'bandwidth.up'),
|
||||
"downmbps" => data_get($protocol_settings, 'bandwidth.down'),
|
||||
"protocol" => 'udp',
|
||||
"peer" => data_get($protocol_settings, 'tls.server_name'),
|
||||
"fastopen" => 1,
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$params['peer'] = $serverName;
|
||||
}
|
||||
if (data_get($protocol_settings, 'obfs.open')) {
|
||||
$params["obfs"] = "xplus";
|
||||
$params["obfsParam"] = data_get($protocol_settings, 'obfs_settings.password');
|
||||
@ -234,10 +238,12 @@ class Shadowrocket implements ProtocolInterface
|
||||
break;
|
||||
case 2:
|
||||
$params = [
|
||||
"peer" => data_get($protocol_settings, 'tls.server_name'),
|
||||
"obfs" => 'none',
|
||||
"fastopen" => 1
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$params['peer'] = $serverName;
|
||||
}
|
||||
if (data_get($protocol_settings, 'obfs.open')) {
|
||||
$params['obfs'] = data_get($protocol_settings, 'obfs.type');
|
||||
$params['obfs-password'] = data_get($protocol_settings, 'obfs.password');
|
||||
|
@ -128,9 +128,11 @@ class SingBox implements ProtocolInterface
|
||||
'tls' => $protocol_settings['tls'] ? [
|
||||
'enabled' => true,
|
||||
'insecure' => (bool) data_get($protocol_settings, 'tls_settings.allow_insecure'),
|
||||
'server_name' => data_get($protocol_settings, 'tls_settings.server_name')
|
||||
] : null
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['tls']['server_name'] = $serverName;
|
||||
}
|
||||
|
||||
$transport = match ($protocol_settings['network']) {
|
||||
'tcp' => [
|
||||
@ -174,12 +176,14 @@ class SingBox implements ProtocolInterface
|
||||
$tlsConfig = [
|
||||
'enabled' => true,
|
||||
'insecure' => (bool) data_get($protocol_settings, 'tls_settings.allow_insecure'),
|
||||
'server_name' => data_get($protocol_settings, 'tls_settings.server_name'),
|
||||
'utls' => [
|
||||
'enabled' => true,
|
||||
'fingerprint' => Helper::getRandFingerprint()
|
||||
]
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$tlsConfig['server_name'] = $serverName;
|
||||
}
|
||||
if ($protocol_settings['tls'] == 2) {
|
||||
$tlsConfig['reality'] = [
|
||||
'enabled' => true,
|
||||
@ -194,7 +198,7 @@ class SingBox implements ProtocolInterface
|
||||
$transport = match ($protocol_settings['network']) {
|
||||
'tcp' => data_get($protocol_settings, 'network_settings.header.type') == 'http' ? [
|
||||
'type' => 'http',
|
||||
'path' => data_get($protocol_settings, 'network_settings.header.request.path')
|
||||
'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']))
|
||||
] : null,
|
||||
'ws' => array_filter([
|
||||
'type' => 'ws',
|
||||
@ -240,9 +244,11 @@ class SingBox implements ProtocolInterface
|
||||
'tls' => [
|
||||
'enabled' => true,
|
||||
'insecure' => (bool) data_get($protocol_settings, 'allow_insecure', false),
|
||||
'server_name' => data_get($protocol_settings, 'server_name')
|
||||
]
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['tls']['server_name'] = $serverName;
|
||||
}
|
||||
$transport = match (data_get($protocol_settings, 'network')) {
|
||||
'grpc' => [
|
||||
'type' => 'grpc',
|
||||
@ -271,9 +277,11 @@ class SingBox implements ProtocolInterface
|
||||
'tls' => [
|
||||
'enabled' => true,
|
||||
'insecure' => (bool) $protocol_settings['tls']['allow_insecure'],
|
||||
'server_name' => $protocol_settings['tls']['server_name']
|
||||
]
|
||||
];
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$baseConfig['tls']['server_name'] = $serverName;
|
||||
}
|
||||
$speedConfig = [
|
||||
'up_mbps' => $protocol_settings['bandwidth']['up'],
|
||||
'down_mbps' => $protocol_settings['bandwidth']['down'],
|
||||
|
@ -142,7 +142,9 @@ class Stash implements ProtocolInterface
|
||||
|
||||
$array['tls'] = data_get($protocol_settings, 'tls');
|
||||
$array['skip-cert-verify'] = data_get($protocol_settings, 'tls_settings.allow_insecure');
|
||||
$array['servername'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['servername'] = $serverName;
|
||||
}
|
||||
|
||||
switch (data_get($protocol_settings, 'network')) {
|
||||
case 'tcp':
|
||||
@ -186,7 +188,9 @@ class Stash implements ProtocolInterface
|
||||
case 1:
|
||||
$array['tls'] = true;
|
||||
$array['skip-cert-verify'] = data_get($protocol_settings, 'tls_settings.allow_insecure');
|
||||
$array['servername'] = data_get($protocol_settings, 'tls_settings.server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
|
||||
$array['servername'] = $serverName;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$array['tls'] = true;
|
||||
@ -241,7 +245,9 @@ class Stash implements ProtocolInterface
|
||||
$array['ws-opts']['headers'] = data_get($protocol_settings, 'network_settings.headers.Host') ? ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')] : null;
|
||||
break;
|
||||
}
|
||||
$array['sni'] = data_get($protocol_settings, 'server_name');
|
||||
if ($serverName = data_get($protocol_settings, 'server_name')) {
|
||||
$array['sni'] = $serverName;
|
||||
}
|
||||
$array['skip-cert-verify'] = data_get($protocol_settings, 'allow_insecure');
|
||||
return $array;
|
||||
}
|
||||
@ -255,7 +261,9 @@ class Stash implements ProtocolInterface
|
||||
$array['up-speed'] = data_get($protocol_settings, 'bandwidth.up');
|
||||
$array['down-speed'] = data_get($protocol_settings, 'bandwidth.down');
|
||||
$array['skip-cert-verify'] = data_get($protocol_settings, 'tls.allow_insecure');
|
||||
$array['sni'] = data_get($protocol_settings, 'tls.server_name') ?? '';
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$array['sni'] = $serverName;
|
||||
}
|
||||
switch (data_get($protocol_settings, 'version')) {
|
||||
case 1:
|
||||
$array['type'] = 'hysteria';
|
||||
|
Loading…
Reference in New Issue
Block a user