feat: 适配 allowInsecure 字段

This commit is contained in:
Cp0204 2024-05-29 13:01:48 +08:00 committed by GitHub
parent 7246eb6ebc
commit 603b240733
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 28 additions and 4 deletions

View File

@ -190,8 +190,8 @@ class ClashMeta
$array['tls'] = true; $array['tls'] = true;
if ($server['tls_settings']) { if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings']; $tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$array['skip-cert-verify'] = ($tlsSettings['allowInsecure'] ? true : false); $array['skip-cert-verify'] = ($tlsSettings['allow_insecure'] ? true : false);
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$array['servername'] = $tlsSettings['server_name']; $array['servername'] = $tlsSettings['server_name'];
} }

View File

@ -71,6 +71,8 @@ class General
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'tcp') { if ((string)$server['network'] === 'tcp') {
@ -119,6 +121,8 @@ class General
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name']; $config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls"; $config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
} }
break; break;
case 2: //reality case 2: //reality

View File

@ -69,6 +69,8 @@ class Passwall
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'tcp') { if ((string)$server['network'] === 'tcp') {
@ -117,6 +119,8 @@ class Passwall
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name']; $config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls"; $config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
} }
break; break;
case 2: //reality case 2: //reality

View File

@ -69,6 +69,8 @@ class SSRPlus
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
@ -105,6 +107,8 @@ class SSRPlus
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name']; $config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls"; $config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
} }
break; break;
case 2: //reality case 2: //reality

View File

@ -70,6 +70,8 @@ class SagerNet
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = urlencode($tlsSettings['serverName']); $config['sni'] = urlencode($tlsSettings['serverName']);
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'tcp') { if ((string)$server['network'] === 'tcp') {

View File

@ -146,8 +146,8 @@ class Shadowrocket
$config['tls'] = 1; $config['tls'] = 1;
if ($server['tls_settings']) { if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings']; $tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = (int)$tlsSettings['allowInsecure']; $config['allowInsecure'] = (int)$tlsSettings['allow_insecure'];
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['peer'] = $tlsSettings['server_name']; $config['peer'] = $tlsSettings['server_name'];
} }

View File

@ -189,6 +189,8 @@ class Stash
case 1: case 1:
if ($server['tls_settings']) { if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings']; $tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$array['skip-cert-verify'] = ($tlsSettings['allow_insecure'] ? true : false);
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$array['servername'] = $tlsSettings['server_name']; $array['servername'] = $tlsSettings['server_name'];
} }

View File

@ -75,6 +75,8 @@ class V2rayN
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'tcp') { if ((string)$server['network'] === 'tcp') {
@ -123,6 +125,8 @@ class V2rayN
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name']; $config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls"; $config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
} }
break; break;
case 2: //reality case 2: //reality

View File

@ -69,6 +69,8 @@ class V2rayNG
$tlsSettings = $server['tlsSettings']; $tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure']))
$config['allowInsecure'] = $tlsSettings['allowInsecure'];
} }
} }
if ((string)$server['network'] === 'tcp') { if ((string)$server['network'] === 'tcp') {
@ -117,6 +119,8 @@ class V2rayNG
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$config['sni'] = $tlsSettings['server_name']; $config['sni'] = $tlsSettings['server_name'];
$config['security'] = "tls"; $config['security'] = "tls";
if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure']))
$config['allowInsecure'] = $tlsSettings['allow_insecure'];
} }
break; break;
case 2: //reality case 2: //reality