Przeglądaj źródła

feat: us for sb v1.8.0

M1Screw 1 rok temu
rodzic
commit
c2ff6203dd

+ 12 - 12
composer.lock

@@ -123,16 +123,16 @@
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.295.5",
+            "version": "3.295.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "cd9d48ebfdfc8fb5f6df9fe95dced622287f3412"
+                "reference": "e3ba36c6e52dce373064fbb1741547828235425f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cd9d48ebfdfc8fb5f6df9fe95dced622287f3412",
-                "reference": "cd9d48ebfdfc8fb5f6df9fe95dced622287f3412",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e3ba36c6e52dce373064fbb1741547828235425f",
+                "reference": "e3ba36c6e52dce373064fbb1741547828235425f",
                 "shasum": ""
             },
             "require": {
@@ -212,9 +212,9 @@
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.295.5"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.295.7"
             },
-            "time": "2024-01-03T19:12:43+00:00"
+            "time": "2024-01-05T19:10:48+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
@@ -4782,16 +4782,16 @@
         },
         {
             "name": "stripe/stripe-php",
-            "version": "v13.7.0",
+            "version": "v13.8.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "1f60eb1a1b86b29f2ba0e14c0ae905ca838c1cdd"
+                "reference": "577d64a3fdc92ba2915263299a69136a2813f4a3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/1f60eb1a1b86b29f2ba0e14c0ae905ca838c1cdd",
-                "reference": "1f60eb1a1b86b29f2ba0e14c0ae905ca838c1cdd",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/577d64a3fdc92ba2915263299a69136a2813f4a3",
+                "reference": "577d64a3fdc92ba2915263299a69136a2813f4a3",
                 "shasum": ""
             },
             "require": {
@@ -4835,9 +4835,9 @@
             ],
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v13.7.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v13.8.0"
             },
-            "time": "2023-12-22T15:57:03+00:00"
+            "time": "2024-01-04T19:52:48+00:00"
         },
         {
             "name": "symfony/deprecation-contracts",

+ 35 - 69
config/appprofile.example.php

@@ -53,44 +53,14 @@ $_ENV['SingBox_Config'] = [
                 'tag' => 'local',
                 'address' => 'local',
             ],
-            [
-                'tag' => 'cloudflare',
-                'address' => 'https://1.1.1.1/dns-query',
-                'address_resolver' => 'local',
-            ],
-            [
-                'tag' => 'dnspod',
-                'address' => 'https://1.12.12.12/dns-query',
-                'detour' => 'direct',
-            ],
         ],
         'rules' => [
             [
                 'outbound' => 'any',
-                'server' => 'dnspod',
-            ],
-            [
-                'clash_mode' => 'Direct',
-                'server' => 'dnspod',
-            ],
-            [
-                'clash_mode' => 'Global',
-                'server' => 'cloudflare',
-            ],
-            [
-                'type' => 'logical',
-                'mode' => 'and',
-                'rules' => [
-                    [
-                        'geosite' => [
-                            'cn',
-                        ],
-                    ],
-                ],
-                'server' => 'dnspod',
+                'server' => 'local',
             ],
         ],
-        'final' => 'cloudflare',
+        'final' => 'local',
         'strategy' => 'prefer_ipv6',
     ],
     'inbounds' => [
@@ -132,34 +102,17 @@ $_ENV['SingBox_Config'] = [
             'type' => 'block',
             'tag' => 'block',
         ],
-        [
-            'type' => 'dns',
-            'tag' => 'dns',
-        ],
     ],
     'route' => [
-        'geoip' => [
-            'download_url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/MetaCubeX/meta-rules-dat@release/geoip-lite.db',
-            'download_detour' => 'direct',
-        ],
-        'geosite' => [
-            'download_url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/MetaCubeX/meta-rules-dat@release/geosite-lite.db',
-            'download_detour' => 'direct',
-        ],
         'rules' => [
-            [
-                'protocol' => 'dns',
-                'outbound' => 'dns',
-            ],
-            [
-                'network' => 'udp',
-                'port' => 53,
-                'outbound' => 'dns',
-            ],
             [
                 'clash_mode' => 'Direct',
                 'outbound' => 'direct',
             ],
+            [
+                'clash_mode' => 'Rule',
+                'outbound' => 'default',
+            ],
             [
                 'clash_mode' => 'Global',
                 'outbound' => 'default',
@@ -169,30 +122,43 @@ $_ENV['SingBox_Config'] = [
                 'outbound' => 'block',
             ],
             [
-                'type' => 'logical',
-                'mode' => 'and',
-                'rules' => [
-                    [
-                        'geosite' => [
-                            'cn',
-                        ],
-                        'geoip' => [
-                            'cn',
-                            'private',
-                        ],
-                    ],
-                ],
+                'ip_is_private' => true,
+                'outbound' => 'direct',
+            ],
+            [
+                'rule_set' => 'geoip-cn',
+                'outbound' => 'direct',
+            ],
+            [
+                'rule_set' => 'geosite-cn',
                 'outbound' => 'direct',
             ],
         ],
+        'rule_set' => [
+            [
+                'tag' => 'geoip-cn',
+                'type' => 'remote',
+                'format' => 'binary',
+                'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geoip@rule-set/geoip-cn.srs',
+                'download_detour' => 'direct',
+            ],
+            [
+                'tag' => 'geosite-cn',
+                'type' => 'remote',
+                'format' => 'binary',
+                'url' => 'https://' . $_ENV['jsdelivr_url'] . '/gh/SagerNet/sing-geosite@rule-set/geosite-cn.srs',
+                'download_detour' => 'direct',
+            ],
+        ],
         'auto_detect_interface' => true,
     ],
     'experimental' => [
+        'cache_file' => [
+            'enabled' => true,
+            'cache_id' => '',
+        ],
         'clash_api' => [
             'external_controller' => '127.0.0.1:9090',
-            'store_mode' => true,
-            'store_selected' => true,
-            'cache_id' => '',
         ],
     ],
 ];

+ 2 - 5
src/Services/Cache.php

@@ -5,13 +5,9 @@ declare(strict_types=1);
 namespace App\Services;
 
 use Redis;
-use RedisException;
 
 final class Cache
 {
-    /**
-     * @throws RedisException
-     */
     public function initRedis(): Redis
     {
         return new Redis(self::getRedisConfig());
@@ -29,11 +25,12 @@ final class Cache
         if ($_ENV['redis_username'] !== '') {
             $config['auth']['user'] = $_ENV['redis_username'];
         }
+
         if ($_ENV['redis_password'] !== '') {
             $config['auth']['pass'] = $_ENV['redis_password'];
         }
 
-        if ($_ENV['redis_ssl'] === true) {
+        if ($_ENV['redis_ssl']) {
             $config['ssl'] = $_ENV['redis_ssl_context'];
         }
 

+ 9 - 5
src/Services/Subscribe/SingBox.php

@@ -34,7 +34,8 @@ final class SingBox extends Base
 
                     break;
                 case 1:
-                    $ss_2022_port = $node_custom_config['offset_port_user'] ?? ($node_custom_config['offset_port_node'] ?? 443);
+                    $ss_2022_port = $node_custom_config['offset_port_user'] ??
+                        ($node_custom_config['offset_port_node'] ?? 443);
                     $method = $node_custom_config['method'] ?? '2022-blake3-aes-128-gcm';
 
                     $pk_len = match ($method) {
@@ -56,7 +57,8 @@ final class SingBox extends Base
 
                     break;
                 case 2:
-                    $tuic_port = $node_custom_config['offset_port_user'] ?? ($node_custom_config['offset_port_node'] ?? 443);
+                    $tuic_port = $node_custom_config['offset_port_user'] ??
+                        ($node_custom_config['offset_port_node'] ?? 443);
                     $host = $node_custom_config['host'] ?? '';
                     $allow_insecure = $node_custom_config['allow_insecure'] ?? false;
                     $congestion_control = $node_custom_config['congestion_control'] ?? 'bbr';
@@ -81,7 +83,8 @@ final class SingBox extends Base
 
                     break;
                 case 11:
-                    $v2_port = $node_custom_config['offset_port_user'] ?? ($node_custom_config['offset_port_node'] ?? 443);
+                    $v2_port = $node_custom_config['offset_port_user'] ??
+                        ($node_custom_config['offset_port_node'] ?? 443);
                     $transport = ($node_custom_config['network'] ?? '') === 'tcp' ? '' : $node_custom_config['network'];
                     $host = $node_custom_config['header']['request']['headers']['Host'][0] ??
                         $node_custom_config['host'] ?? '';
@@ -113,7 +116,8 @@ final class SingBox extends Base
 
                     break;
                 case 14:
-                    $trojan_port = $node_custom_config['offset_port_user'] ?? ($node_custom_config['offset_port_node'] ?? 443);
+                    $trojan_port = $node_custom_config['offset_port_user'] ??
+                        ($node_custom_config['offset_port_node'] ?? 443);
                     $host = $node_custom_config['host'] ?? '';
                     $allow_insecure = $node_custom_config['allow_insecure'] ?? '0';
                     $transport = $node_custom_config['network'] ?? '';
@@ -158,7 +162,7 @@ final class SingBox extends Base
         }
 
         $singbox_config['outbounds'] = array_merge($singbox_config['outbounds'], $nodes);
-        $singbox_config['experimental']['clash_api']['cache_id'] = $_ENV['appName'];
+        $singbox_config['experimental']['cache_file']['cache_id'] = $_ENV['appName'];
 
         return json_encode($singbox_config);
     }