diff --git a/src/Services/Subscribe/Clash.php b/src/Services/Subscribe/Clash.php index 5cb6bd14e..259a1a909 100755 --- a/src/Services/Subscribe/Clash.php +++ b/src/Services/Subscribe/Clash.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Services\Subscribe; use App\Services\Subscribe; +use App\Services\TomTool\Nice as TomNice; use App\Utils\Tools; use function array_merge; use function json_decode; @@ -95,12 +96,12 @@ final class Clash extends Base $v2_port = $node_custom_config['offset_port_user'] ?? ($node_custom_config['offset_port_node'] ?? 443); $network = $node_custom_config['network'] ?? 'tcp'; - $udp = $node_custom_config['udp'] ?? true; - $tls = $node_custom_config['tls'] ?? true; + $udp = $node_custom_config['udp'] ?? false; + $tls = $node_custom_config['tls'] ?? false; $browser = $node_custom_config['browser'] ?? 'chrome'; $servername = $node_custom_config['servername'] ?? ''; $flow = $node_custom_config['flow'] ?? ''; - + $node = [ 'name' => $node_raw->name, 'type' => 'vless', @@ -108,8 +109,8 @@ final class Clash extends Base 'port' => (int) $v2_port, 'network' => $network, 'uuid' => $user->uuid, - 'udp' => (bool) $udp, - 'tls' => (bool) $tls, + 'udp' => (bool) TomNice::ensureBool($udp), + 'tls' => (bool) TomNice::ensureBool($tls), 'servername' => $servername, 'flow' => $flow, 'client-fingerprint' => $browser diff --git a/src/Services/TomTool/Nice.php b/src/Services/TomTool/Nice.php new file mode 100755 index 000000000..adf12fcc4 --- /dev/null +++ b/src/Services/TomTool/Nice.php @@ -0,0 +1,30 @@ + FILTER_NULL_ON_FAILURE + ]) ?? $bDefault; + } + + +}