From 603b240733c453884688916df5d620664c0a0fe4 Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Wed, 29 May 2024 13:01:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=20allowInsecure=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Protocols/ClashMeta.php | 4 ++-- app/Protocols/General.php | 4 ++++ app/Protocols/Passwall.php | 4 ++++ app/Protocols/SSRPlus.php | 4 ++++ app/Protocols/SagerNet.php | 2 ++ app/Protocols/Shadowrocket.php | 4 ++-- app/Protocols/Stash.php | 2 ++ app/Protocols/V2rayN.php | 4 ++++ app/Protocols/V2rayNG.php | 4 ++++ 9 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index a212e12..4f33de5 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -190,8 +190,8 @@ class ClashMeta $array['tls'] = true; if ($server['tls_settings']) { $tlsSettings = $server['tls_settings']; - if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) - $array['skip-cert-verify'] = ($tlsSettings['allowInsecure'] ? true : false); + 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'])) $array['servername'] = $tlsSettings['server_name']; } diff --git a/app/Protocols/General.php b/app/Protocols/General.php index 7de9186..ab5b844 100644 --- a/app/Protocols/General.php +++ b/app/Protocols/General.php @@ -71,6 +71,8 @@ class General $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = $tlsSettings['serverName']; + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'tcp') { @@ -119,6 +121,8 @@ class General if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['sni'] = $tlsSettings['server_name']; $config['security'] = "tls"; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = $tlsSettings['allow_insecure']; } break; case 2: //reality diff --git a/app/Protocols/Passwall.php b/app/Protocols/Passwall.php index 66efd33..795b2e8 100644 --- a/app/Protocols/Passwall.php +++ b/app/Protocols/Passwall.php @@ -69,6 +69,8 @@ class Passwall $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = $tlsSettings['serverName']; + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'tcp') { @@ -117,6 +119,8 @@ class Passwall if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['sni'] = $tlsSettings['server_name']; $config['security'] = "tls"; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = $tlsSettings['allow_insecure']; } break; case 2: //reality diff --git a/app/Protocols/SSRPlus.php b/app/Protocols/SSRPlus.php index 1d32a61..9114b01 100644 --- a/app/Protocols/SSRPlus.php +++ b/app/Protocols/SSRPlus.php @@ -69,6 +69,8 @@ class SSRPlus $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = $tlsSettings['serverName']; + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'ws') { @@ -105,6 +107,8 @@ class SSRPlus if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['sni'] = $tlsSettings['server_name']; $config['security'] = "tls"; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = $tlsSettings['allow_insecure']; } break; case 2: //reality diff --git a/app/Protocols/SagerNet.php b/app/Protocols/SagerNet.php index 65f5fdd..09b19f3 100644 --- a/app/Protocols/SagerNet.php +++ b/app/Protocols/SagerNet.php @@ -70,6 +70,8 @@ class SagerNet $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = urlencode($tlsSettings['serverName']); + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'tcp') { diff --git a/app/Protocols/Shadowrocket.php b/app/Protocols/Shadowrocket.php index 57ab17f..4cc4fa8 100644 --- a/app/Protocols/Shadowrocket.php +++ b/app/Protocols/Shadowrocket.php @@ -146,8 +146,8 @@ class Shadowrocket $config['tls'] = 1; if ($server['tls_settings']) { $tlsSettings = $server['tls_settings']; - if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) - $config['allowInsecure'] = (int)$tlsSettings['allowInsecure']; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = (int)$tlsSettings['allow_insecure']; if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['peer'] = $tlsSettings['server_name']; } diff --git a/app/Protocols/Stash.php b/app/Protocols/Stash.php index 7e004c7..3631e4f 100644 --- a/app/Protocols/Stash.php +++ b/app/Protocols/Stash.php @@ -189,6 +189,8 @@ class Stash case 1: if ($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'])) $array['servername'] = $tlsSettings['server_name']; } diff --git a/app/Protocols/V2rayN.php b/app/Protocols/V2rayN.php index cb353f4..ac6fb65 100644 --- a/app/Protocols/V2rayN.php +++ b/app/Protocols/V2rayN.php @@ -75,6 +75,8 @@ class V2rayN $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = $tlsSettings['serverName']; + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'tcp') { @@ -123,6 +125,8 @@ class V2rayN if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['sni'] = $tlsSettings['server_name']; $config['security'] = "tls"; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = $tlsSettings['allow_insecure']; } break; case 2: //reality diff --git a/app/Protocols/V2rayNG.php b/app/Protocols/V2rayNG.php index c758cfb..3dc51b3 100644 --- a/app/Protocols/V2rayNG.php +++ b/app/Protocols/V2rayNG.php @@ -69,6 +69,8 @@ class V2rayNG $tlsSettings = $server['tlsSettings']; if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName'])) $config['sni'] = $tlsSettings['serverName']; + if (isset($tlsSettings['allowInsecure']) && !empty($tlsSettings['allowInsecure'])) + $config['allowInsecure'] = $tlsSettings['allowInsecure']; } } if ((string)$server['network'] === 'tcp') { @@ -117,6 +119,8 @@ class V2rayNG if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name'])) $config['sni'] = $tlsSettings['server_name']; $config['security'] = "tls"; + if (isset($tlsSettings['allow_insecure']) && !empty($tlsSettings['allow_insecure'])) + $config['allowInsecure'] = $tlsSettings['allow_insecure']; } break; case 2: //reality