Ver Fonte

feat: us tuic & ss2022 & new node types

M1Screw há 2 anos atrás
pai
commit
36bd60679b

+ 1 - 0
composer.json

@@ -5,6 +5,7 @@
         "ext-curl": "*",
         "ext-curl": "*",
         "ext-fileinfo": "*",
         "ext-fileinfo": "*",
         "ext-json": "*",
         "ext-json": "*",
+        "ext-mbstring": "*",
         "ext-mysqli": "*",
         "ext-mysqli": "*",
         "ext-openssl": "*",
         "ext-openssl": "*",
         "ext-pdo": "*",
         "ext-pdo": "*",

+ 27 - 35
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
         "This file is @generated automatically"
     ],
     ],
-    "content-hash": "02453d2715cf86e568a5235e9dadb9f6",
+    "content-hash": "f976870cacdcfc65b6258d49ca0ff3af",
     "packages": [
     "packages": [
         {
         {
             "name": "anankke/omnipay-alipay",
             "name": "anankke/omnipay-alipay",
@@ -123,16 +123,16 @@
         },
         },
         {
         {
             "name": "aws/aws-sdk-php",
             "name": "aws/aws-sdk-php",
-            "version": "3.281.6",
+            "version": "3.281.8",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "b83c543a9ff07fc1d9f11766ee77fc7f4deed2b9"
+                "reference": "eb349b9f31502a05c70362f57913b9fed6b65b1f"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b83c543a9ff07fc1d9f11766ee77fc7f4deed2b9",
-                "reference": "b83c543a9ff07fc1d9f11766ee77fc7f4deed2b9",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/eb349b9f31502a05c70362f57913b9fed6b65b1f",
+                "reference": "eb349b9f31502a05c70362f57913b9fed6b65b1f",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -212,9 +212,9 @@
             "support": {
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.281.6"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.281.8"
             },
             },
-            "time": "2023-09-13T18:07:28+00:00"
+            "time": "2023-09-15T18:34:59+00:00"
         },
         },
         {
         {
             "name": "bacon/bacon-qr-code",
             "name": "bacon/bacon-qr-code",
@@ -4723,16 +4723,16 @@
         },
         },
         {
         {
             "name": "smarty/smarty",
             "name": "smarty/smarty",
-            "version": "v4.3.2",
+            "version": "v4.3.4",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/smarty-php/smarty.git",
                 "url": "https://github.com/smarty-php/smarty.git",
-                "reference": "1d9cda2be34fd6edb74924684260636fd0b89288"
+                "reference": "3931d8f54b8f7a4ffab538582d34d4397ba8daa5"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/1d9cda2be34fd6edb74924684260636fd0b89288",
-                "reference": "1d9cda2be34fd6edb74924684260636fd0b89288",
+                "url": "https://api.github.com/repos/smarty-php/smarty/zipball/3931d8f54b8f7a4ffab538582d34d4397ba8daa5",
+                "reference": "3931d8f54b8f7a4ffab538582d34d4397ba8daa5",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -4783,9 +4783,9 @@
             "support": {
             "support": {
                 "forum": "https://github.com/smarty-php/smarty/discussions",
                 "forum": "https://github.com/smarty-php/smarty/discussions",
                 "issues": "https://github.com/smarty-php/smarty/issues",
                 "issues": "https://github.com/smarty-php/smarty/issues",
-                "source": "https://github.com/smarty-php/smarty/tree/v4.3.2"
+                "source": "https://github.com/smarty-php/smarty/tree/v4.3.4"
             },
             },
-            "time": "2023-07-19T10:27:36+00:00"
+            "time": "2023-09-14T10:59:08+00:00"
         },
         },
         {
         {
             "name": "srmklive/paypal",
             "name": "srmklive/paypal",
@@ -4898,16 +4898,16 @@
         },
         },
         {
         {
             "name": "stripe/stripe-php",
             "name": "stripe/stripe-php",
-            "version": "v12.2.0",
+            "version": "v12.3.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "07829f2102362b0bfe0b680dab801e00cc4dce89"
+                "reference": "260aad072f92ddb05e03d47af13b3616d99b3444"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/07829f2102362b0bfe0b680dab801e00cc4dce89",
-                "reference": "07829f2102362b0bfe0b680dab801e00cc4dce89",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/260aad072f92ddb05e03d47af13b3616d99b3444",
+                "reference": "260aad072f92ddb05e03d47af13b3616d99b3444",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -4953,9 +4953,9 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v12.2.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v12.3.0"
             },
             },
-            "time": "2023-09-07T18:03:22+00:00"
+            "time": "2023-09-15T00:57:14+00:00"
         },
         },
         {
         {
             "name": "symfony/deprecation-contracts",
             "name": "symfony/deprecation-contracts",
@@ -6319,20 +6319,21 @@
         },
         },
         {
         {
             "name": "tronovav/geoip2-update",
             "name": "tronovav/geoip2-update",
-            "version": "v2.1.24",
+            "version": "v2.2.2",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/tronovav/geoip2-update.git",
                 "url": "https://github.com/tronovav/geoip2-update.git",
-                "reference": "6b91582eb11d4c39cfe66b3178ac0a6c67839cf9"
+                "reference": "35ea93da5784740ffe308be0888131efa94a0e0b"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/tronovav/geoip2-update/zipball/6b91582eb11d4c39cfe66b3178ac0a6c67839cf9",
-                "reference": "6b91582eb11d4c39cfe66b3178ac0a6c67839cf9",
+                "url": "https://api.github.com/repos/tronovav/geoip2-update/zipball/35ea93da5784740ffe308be0888131efa94a0e0b",
+                "reference": "35ea93da5784740ffe308be0888131efa94a0e0b",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
                 "ext-curl": "*",
                 "ext-curl": "*",
+                "ext-json": "*",
                 "php": ">=5.3"
                 "php": ">=5.3"
             },
             },
             "suggest": {
             "suggest": {
@@ -6365,19 +6366,9 @@
             "support": {
             "support": {
                 "email": "[email protected]",
                 "email": "[email protected]",
                 "issues": "https://github.com/tronovav/geoip2-update/issues",
                 "issues": "https://github.com/tronovav/geoip2-update/issues",
-                "source": "https://github.com/tronovav/geoip2-update/tree/v2.1.24"
+                "source": "https://github.com/tronovav/geoip2-update/tree/v2.2.2"
             },
             },
-            "funding": [
-                {
-                    "url": "https://donate.stream/tronovav",
-                    "type": "other"
-                },
-                {
-                    "url": "https://yoomoney.ru/to/410016198845596",
-                    "type": "other"
-                }
-            ],
-            "time": "2023-03-13T11:43:07+00:00"
+            "time": "2023-09-15T22:25:45+00:00"
         },
         },
         {
         {
             "name": "vectorface/googleauthenticator",
             "name": "vectorface/googleauthenticator",
@@ -10277,6 +10268,7 @@
         "ext-curl": "*",
         "ext-curl": "*",
         "ext-fileinfo": "*",
         "ext-fileinfo": "*",
         "ext-json": "*",
         "ext-json": "*",
+        "ext-mbstring": "*",
         "ext-mysqli": "*",
         "ext-mysqli": "*",
         "ext-openssl": "*",
         "ext-openssl": "*",
         "ext-pdo": "*",
         "ext-pdo": "*",

+ 4 - 2
resources/views/tabler/admin/node/create.tpl

@@ -65,7 +65,9 @@
                                 <div class="col">
                                 <div class="col">
                                     <select id="sort" class="col form-select">
                                     <select id="sort" class="col form-select">
                                         <option value="14">Trojan</option>
                                         <option value="14">Trojan</option>
-                                        <option value="11">V2Ray</option>
+                                        <option value="11">Vmess</option>
+                                        <option value="2">TUIC</option>
+                                        <option value="1">Shadowsocks2022</option>
                                         <option value="0">Shadowsocks</option>
                                         <option value="0">Shadowsocks</option>
                                     </select>
                                     </select>
                                 </div>
                                 </div>
@@ -184,4 +186,4 @@
     });
     });
 </script>
 </script>
 
 
-{include file='admin/footer.tpl'}
+{include file='admin/footer.tpl'}

+ 4 - 2
resources/views/tabler/admin/node/edit.tpl

@@ -65,7 +65,9 @@
                                 <div class="col">
                                 <div class="col">
                                     <select id="sort" class="col form-select" value="{$node->sort}">
                                     <select id="sort" class="col form-select" value="{$node->sort}">
                                         <option value="14" {if $node->sort === 14}selected{/if}>Trojan</option>
                                         <option value="14" {if $node->sort === 14}selected{/if}>Trojan</option>
-                                        <option value="11" {if $node->sort === 11}selected{/if}>V2Ray</option>
+                                        <option value="11" {if $node->sort === 11}selected{/if}>Vmess</option>
+                                        <option value="2" {if $node->sort === 2}selected{/if}>TUIC</option>
+                                        <option value="1" {if $node->sort === 1}selected{/if}>Shadowsocks2022</option>
                                         <option value="0" {if $node->sort === 0}selected{/if}>Shadowsocks</option>
                                         <option value="0" {if $node->sort === 0}selected{/if}>Shadowsocks</option>
                                     </select>
                                     </select>
                                 </div>
                                 </div>
@@ -233,4 +235,4 @@
     });
     });
 </script>
 </script>
 
 
-{include file='admin/footer.tpl'}
+{include file='admin/footer.tpl'}

+ 1 - 8
src/Controllers/WebAPI/NodeController.php

@@ -27,13 +27,6 @@ final class NodeController extends BaseController
             ]);
             ]);
         }
         }
 
 
-        if ($node->sort === 0) {
-            $node_explode = explode(';', $node->server);
-            $node_server = $node_explode[0];
-        } else {
-            $node_server = $node->server;
-        }
-
         $data = [
         $data = [
             'node_group' => $node->node_group,
             'node_group' => $node->node_group,
             'node_class' => $node->node_class,
             'node_class' => $node->node_class,
@@ -41,7 +34,7 @@ final class NodeController extends BaseController
             'traffic_rate' => $node->traffic_rate,
             'traffic_rate' => $node->traffic_rate,
             'mu_only' => 0,
             'mu_only' => 0,
             'sort' => $node->sort,
             'sort' => $node->sort,
-            'server' => $node_server,
+            'server' => $node->server,
             'custom_config' => json_decode($node->custom_config, true, JSON_UNESCAPED_SLASHES),
             'custom_config' => json_decode($node->custom_config, true, JSON_UNESCAPED_SLASHES),
             'type' => 'SSPanel-UIM',
             'type' => 'SSPanel-UIM',
             'version' => VERSION,
             'version' => VERSION,

+ 13 - 0
src/Controllers/WebAPI/UserController.php

@@ -87,6 +87,8 @@ final class UserController extends BaseController
 
 
         $keys_unset = match ((int) $node->sort) {
         $keys_unset = match ((int) $node->sort) {
             14, 11 => ['u', 'd', 'transfer_enable', 'method', 'port', 'passwd'],
             14, 11 => ['u', 'd', 'transfer_enable', 'method', 'port', 'passwd'],
+            2 => ['u', 'd', 'transfer_enable', 'method', 'port'],
+            1 => ['u', 'd', 'transfer_enable', 'method', 'port', 'uuid'],
             default => ['u', 'd', 'transfer_enable', 'uuid']
             default => ['u', 'd', 'transfer_enable', 'uuid']
         };
         };
 
 
@@ -102,6 +104,17 @@ final class UserController extends BaseController
                 }
                 }
             }
             }
 
 
+            if ($node->sort === 1) {
+                $method = json_decode($node->custom_config)->method ?? '2022-blake3-aes-128-gcm';
+
+                $pk_len = match ($method) {
+                    '2022-blake3-aes-128-gcm' => 16,
+                    default => 32,
+                };
+
+                $user_raw->passwd = Tools::getSs2022UserPk($user_raw, $pk_len);
+            }
+
             $user_raw->node_connector = 0;
             $user_raw->node_connector = 0;
 
 
             foreach ($keys_unset as $key) {
             foreach ($keys_unset as $key) {

+ 1 - 1
src/Models/Node.php

@@ -51,7 +51,7 @@ final class Node extends Model
             0 => 'Shadowsocks',
             0 => 'Shadowsocks',
             1 => 'Shadowsocks2022',
             1 => 'Shadowsocks2022',
             2 => 'TUIC',
             2 => 'TUIC',
-            11 => 'V2Ray',
+            11 => 'Vmess',
             14 => 'Trojan',
             14 => 'Trojan',
             default => '未知',
             default => '未知',
         };
         };

+ 49 - 0
src/Services/Subscribe/Clash.php

@@ -52,6 +52,55 @@ final class Clash extends Base
                         'plugin-opts' => $plugin_option,
                         'plugin-opts' => $plugin_option,
                     ];
                     ];
 
 
+                    break;
+                case 1:
+                    $ss_2022_port = $node_custom_config['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) {
+                        '2022-blake3-aes-128-gcm' => 16,
+                        default => 32,
+                    };
+
+                    $user_pk = Tools::getSs2022UserPk($user, $pk_len);
+                    $plugin = $node_custom_config['plugin'] ?? '';
+                    $plugin_option = $node_custom_config['plugin_option'] ?? null;
+                    // Clash 特定配置
+                    $udp = $node_custom_config['udp'] ?? true;
+                    // Clash.Meta
+                    $client_fingerprint = $node_custom_config['client_fingerprint'] ?? '';
+
+                    $node = [
+                        'name' => $node_raw->name,
+                        'type' => 'ss',
+                        'server' => $server,
+                        'port' => (int) $ss_2022_port,
+                        'password' => $user_pk,
+                        'cipher' => $method,
+                        'udp' => $udp,
+                        'client-fingerprint' => $client_fingerprint,
+                        'plugin' => $plugin,
+                        'plugin-opts' => $plugin_option,
+                    ];
+
+                    break;
+                case 2:
+                    $tuic_port = $node_custom_config['tuic_port'] ?? ($node_custom_config['offset_port_user']
+                        ?? ($node_custom_config['offset_port_node'] ?? 443));
+                    $sni = $node_custom_config['sni'] ?? '';
+
+                    // Tuic V5 Only
+                    $node = [
+                        'name' => $node_raw->name,
+                        'type' => 'tuic',
+                        'server' => $server,
+                        'port' => (int) $tuic_port,
+                        'password' => $user->passwd,
+                        'uuid' => $user->uuid,
+                        'sni' => $sni,
+                    ];
+
                     break;
                     break;
                 case 11:
                 case 11:
                     $v2_port = $node_custom_config['v2_port'] ?? ($node_custom_config['offset_port_user']
                     $v2_port = $node_custom_config['v2_port'] ?? ($node_custom_config['offset_port_user']

+ 40 - 0
src/Services/Subscribe/SingBox.php

@@ -44,6 +44,46 @@ final class SingBox extends Base
                         'plugin_opts' => $plugin_option,
                         'plugin_opts' => $plugin_option,
                     ];
                     ];
 
 
+                    break;
+                case 1:
+                    $ss_2022_port = $node_custom_config['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) {
+                        '2022-blake3-aes-128-gcm' => 16,
+                        default => 32,
+                    };
+
+                    $user_pk = Tools::getSs2022UserPk($user, $pk_len);
+                    $plugin = $node_custom_config['plugin'] ?? '';
+                    $plugin_option = $node_custom_config['plugin_option'] ?? '';
+
+                    $node = [
+                        'type' => 'shadowsocks',
+                        'tag' => $node_raw->name,
+                        'server' => $server,
+                        'server_port' => (int) $ss_2022_port,
+                        'method' => $method,
+                        'password' => $user_pk,
+                        'plugin' => $plugin,
+                        'plugin_opts' => $plugin_option,
+                    ];
+
+                    break;
+                case 2:
+                    $tuic_port = $node_custom_config['tuic_port'] ?? ($node_custom_config['offset_port_user']
+                        ?? ($node_custom_config['offset_port_node'] ?? 443));
+
+                    $node = [
+                        'type' => 'tuic',
+                        'tag' => $node_raw->name,
+                        'server' => $server,
+                        'server_port' => (int) $tuic_port,
+                        'uuid' => $user->uuid,
+                        'password' => $user->passwd,
+                    ];
+
                     break;
                     break;
                 case 11:
                 case 11:
                     $v2_port = $node_custom_config['v2_port'] ?? ($node_custom_config['offset_port_user']
                     $v2_port = $node_custom_config['v2_port'] ?? ($node_custom_config['offset_port_user']

+ 13 - 0
src/Utils/Tools.php

@@ -344,4 +344,17 @@ final class Tools
             ->orderBy('name')
             ->orderBy('name')
             ->get();
             ->get();
     }
     }
+
+    public static function getSs2022UserPk($user, $len): string
+    {
+        $passwd_hash = hash('sha256', $user->passwd);
+
+        $pk = match ($len) {
+            16 => mb_strcut($passwd_hash, 0, 16),
+            32 => mb_strcut($passwd_hash, 0, 32),
+            default => $passwd_hash,
+        };
+
+        return base64_encode($pk);
+    }
 }
 }