fix: correct know file issues
Some checks are pending
Docker Build and Publish / build (push) Waiting to run

This commit is contained in:
xboard 2025-01-12 23:57:24 +08:00
parent efe8c2a96d
commit 1926d6a867
7 changed files with 66 additions and 30 deletions

View File

@ -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')) {

View File

@ -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':

View File

@ -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';
}

View File

@ -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);

View File

@ -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');

View File

@ -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'],

View File

@ -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';