From 575bbe51742ae8d1092494be9a32af53c51c8fc8 Mon Sep 17 00:00:00 2001 From: Beta Soft Date: Fri, 9 Oct 2020 08:29:42 +0800 Subject: [PATCH 1/5] dumpCSV: add BOM to prevent Chinese garbled in Excel Signed-off-by: Beta Soft --- app/Http/Controllers/Admin/UserController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 2c025c38..4753240d 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -133,7 +133,7 @@ class UserController extends Controller $subscribeUrl = $baseUrl . '/api/v1/client/subscribe?token=' . $user['token']; $data .= "{$user['email']},{$balance},{$commissionBalance},{$transferEnable},{$notUseFlow},{$expireDate},{$planName},{$subscribeUrl}\r\n"; } - echo $data; + echo "\xEF\xBB\xBF" . $data; } public function generate(UserGenerate $request) From 2bc77526fd9d0de9b41daa93bd39715b09a05638 Mon Sep 17 00:00:00 2001 From: Mazeorz <67795943+Mazeorz@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:49:16 +0800 Subject: [PATCH 2/5] Fix Shadowsocks of Surfboard Modified the generated parameter format --- app/Utils/Surfboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Utils/Surfboard.php b/app/Utils/Surfboard.php index aa453f96..64bbe943 100644 --- a/app/Utils/Surfboard.php +++ b/app/Utils/Surfboard.php @@ -12,7 +12,7 @@ class Surfboard "{$server->host}", "{$server->port}", "{$server->cipher}", - "password={$password}", + "{$password}", "https://raw.githubusercontent.com/Hackl0us/proxy-tool-backup/master/SSEncrypt.module", "tfo=true", "udp-relay=true" From 5d6fc442819538710232acf36e33755814ed5b12 Mon Sep 17 00:00:00 2001 From: Beta Soft Date: Fri, 9 Oct 2020 21:47:36 +0800 Subject: [PATCH 3/5] Utils: adjust QuantumultX & Surge & Surfboard & Clash Signed-off-by: Beta Soft --- app/Utils/Clash.php | 12 +++------ app/Utils/QuantumultX.php | 16 ++++++----- app/Utils/Surfboard.php | 19 ++++++------- app/Utils/Surge.php | 57 ++++++++++++++++++++++++++++----------- 4 files changed, 62 insertions(+), 42 deletions(-) diff --git a/app/Utils/Clash.php b/app/Utils/Clash.php index 8ad9ee53..b3f2c3b0 100644 --- a/app/Utils/Clash.php +++ b/app/Utils/Clash.php @@ -32,8 +32,8 @@ class Clash if ($server->tls) { $tlsSettings = json_decode($server->tlsSettings); $array['tls'] = true; - if (isset($tlsSettings->allowInsecure)) $array['skip-cert-verify'] = ($tlsSettings->allowInsecure ? true : false ); - if (isset($tlsSettings->serverName)) $array['servername'] = $tlsSettings->serverName; + if (!empty($tlsSettings->allowInsecure)) $array['skip-cert-verify'] = ($tlsSettings->allowInsecure ? true : false ); + if (!empty($tlsSettings->serverName)) $array['servername'] = $tlsSettings->serverName; } if ($server->network == 'ws') { $array['network'] = $server->network; @@ -57,12 +57,8 @@ class Clash $array['port'] = $server->port; $array['password'] = $password; $array['udp'] = true; - $array['sni'] = $server->server_name; - if ($server->allow_insecure) { - $array['skip-cert-verify'] = true; - } else { - $array['skip-cert-verify'] = false; - } + if (!empty($server->server_name)) $array['sni'] = $server->server_name; + if (!empty($server->allow_insecure)) $array['skip-cert-verify'] = ($server->allow_insecure ? true : false ); return $array; } } diff --git a/app/Utils/QuantumultX.php b/app/Utils/QuantumultX.php index 1c923a38..946749ca 100644 --- a/app/Utils/QuantumultX.php +++ b/app/Utils/QuantumultX.php @@ -11,8 +11,8 @@ class QuantumultX "shadowsocks={$server->host}:{$server->port}", "method={$server->cipher}", "password={$password}", - "fast-open=true", - "udp-relay=true", + 'fast-open=true', + 'udp-relay=true', "tag={$server->name}" ]; $config = array_filter($config); @@ -25,8 +25,10 @@ class QuantumultX { $config = [ "vmess={$server->host}:{$server->port}", - "method=chacha20-poly1305", + 'method=chacha20-poly1305', "password={$uuid}", + 'fast-open=true', + 'udp-relay=true', "tag={$server->name}" ]; if ($server->network === 'tcp') { @@ -37,7 +39,7 @@ class QuantumultX // Tips: allowInsecure=false = tls-verification=true array_push($config, $tlsSettings->allowInsecure ? 'tls-verification=false' : 'tls-verification=true'); } - if (isset($tlsSettings->serverName)) { + if (!empty($tlsSettings->serverName)) { array_push($config, "obfs-host={$tlsSettings->serverName}"); } } @@ -70,12 +72,12 @@ class QuantumultX $config = [ "trojan={$server->host}:{$server->port}", "password={$password}", - "over-tls=true", + 'over-tls=true', $server->server_name ? "tls-host={$server->server_name}" : "", // Tips: allowInsecure=false = tls-verification=true $server->allow_insecure ? 'tls-verification=false' : 'tls-verification=true', - "fast-open=false", - "udp-relay=false", + 'fast-open=true', + 'udp-relay=true', "tag={$server->name}" ]; $config = array_filter($config); diff --git a/app/Utils/Surfboard.php b/app/Utils/Surfboard.php index aa453f96..299fd05c 100644 --- a/app/Utils/Surfboard.php +++ b/app/Utils/Surfboard.php @@ -12,10 +12,10 @@ class Surfboard "{$server->host}", "{$server->port}", "{$server->cipher}", - "password={$password}", - "https://raw.githubusercontent.com/Hackl0us/proxy-tool-backup/master/SSEncrypt.module", - "tfo=true", - "udp-relay=true" + "{$password}", + 'https://raw.githubusercontent.com/Hackl0us/proxy-tool-backup/master/SSEncrypt.module', + 'tfo=true', + 'udp-relay=true' ]; $config = array_filter($config); $uri = implode(',', $config); @@ -30,19 +30,16 @@ class Surfboard "{$server->host}", "{$server->port}", "username={$uuid}", - "tfo=true", - "udp-relay=false" + 'tfo=true', + 'udp-relay=true' ]; if ($server->network === 'tcp') { if ($server->tls) { $tlsSettings = json_decode($server->tlsSettings); array_push($config, $server->tls ? 'tls=true' : 'tls=false'); - if (isset($tlsSettings->allowInsecure)) { + if (!empty($tlsSettings->allowInsecure)) { array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false'); } - if (isset($tlsSettings->serverName)) { - array_push($config, "obfs-host={$tlsSettings->serverName}"); - } } } @@ -51,7 +48,7 @@ class Surfboard if ($server->tls) { $tlsSettings = json_decode($server->tlsSettings); array_push($config, $server->tls ? 'tls=true' : 'tls=false'); - if (isset($tlsSettings->allowInsecure)) { + if (!empty($tlsSettings->allowInsecure)) { array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false'); } } diff --git a/app/Utils/Surge.php b/app/Utils/Surge.php index fbfeefeb..a7cd6731 100644 --- a/app/Utils/Surge.php +++ b/app/Utils/Surge.php @@ -13,8 +13,8 @@ class Surge "{$server->port}", "encrypt-method={$server->cipher}", "password={$password}", - "tfo=true", - "udp-relay=true" + 'tfo=true', + 'udp-relay=true' ]; $config = array_filter($config); $uri = implode(',', $config); @@ -24,24 +24,46 @@ class Surge public static function buildVmess($uuid, $server) { - $proxies = $server->name . ' = vmess, ' . $server->host . ', ' . $server->port . ', username=' . $uuid . ', tfo=true'; - if ($server->tls) { - $tlsSettings = json_decode($server->tlsSettings); - $proxies .= ', tls=' . ($server->tls ? "true" : "false"); - if (isset($tlsSettings->allowInsecure)) { - $proxies .= ', skip-cert-verify=' . ($tlsSettings->allowInsecure ? "true" : "false"); + $config = [ + "{$server->name}=vmess", + "{$server->host}", + "{$server->port}", + "username={$uuid}", + 'tfo=true', + 'udp-relay=true' + ]; + if ($server->network === 'tcp') { + if ($server->tls) { + $tlsSettings = json_decode($server->tlsSettings); + array_push($config, $server->tls ? 'tls=true' : 'tls=false'); + if (!empty($tlsSettings->allowInsecure)) { + array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false'); + } + if (!empty($tlsSettings->serverName)) { + array_push($config, "sni={$tlsSettings->serverName}"); + } } } - if ($server->network == 'ws') { - $proxies .= ', ws=true'; + + if ($server->network === 'ws') { + array_push($config, 'ws=true'); + if ($server->tls) { + $tlsSettings = json_decode($server->tlsSettings); + array_push($config, $server->tls ? 'tls=true' : 'tls=false'); + if (!empty($tlsSettings->allowInsecure)) { + array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false'); + } + } if ($server->networkSettings) { $wsSettings = json_decode($server->networkSettings); - if (isset($wsSettings->path)) $proxies .= ', ws-path=' . $wsSettings->path; - if (isset($wsSettings->headers->Host)) $proxies .= ', ws-headers=host:' . $wsSettings->headers->Host; + if (isset($wsSettings->path)) array_push($config, "ws-path={$wsSettings->path}"); + if (isset($wsSettings->headers->Host)) array_push($config, "ws-headers=host:{$wsSettings->headers->Host}"); } } - $proxies .= "\r\n"; - return $proxies; + + $uri = implode(',', $config); + $uri .= "\r\n"; + return $uri; } public static function buildTrojan($password, $server) @@ -51,10 +73,13 @@ class Surge "{$server->host}", "{$server->port}", "password={$password}", - $server->allow_insecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false', $server->server_name ? "sni={$server->server_name}" : "", - "tfo=true" + 'tfo=true', + 'udp-relay=true' ]; + if (!empty($server->allow_insecure)) { + array_push($config, $server->allow_insecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false'); + } $config = array_filter($config); $uri = implode(',', $config); $uri .= "\r\n"; From 0d750af0cb3801a6bc61740b55a1e21345b38e98 Mon Sep 17 00:00:00 2001 From: tokumeikoi <58434450+tokumeikoi@users.noreply.github.com> Date: Thu, 29 Oct 2020 14:41:38 +0800 Subject: [PATCH 4/5] Revert "Fix Shadowsocks of Surfboard" --- app/Utils/Surfboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Utils/Surfboard.php b/app/Utils/Surfboard.php index 64bbe943..aa453f96 100644 --- a/app/Utils/Surfboard.php +++ b/app/Utils/Surfboard.php @@ -12,7 +12,7 @@ class Surfboard "{$server->host}", "{$server->port}", "{$server->cipher}", - "{$password}", + "password={$password}", "https://raw.githubusercontent.com/Hackl0us/proxy-tool-backup/master/SSEncrypt.module", "tfo=true", "udp-relay=true" From 8c777807a91ebbdfe9948d92337ba439397ed7df Mon Sep 17 00:00:00 2001 From: Beta Soft Date: Thu, 29 Oct 2020 14:48:37 +0800 Subject: [PATCH 5/5] ShadowsocksTidalabController: update name Signed-off-by: Beta Soft --- app/Http/Controllers/Server/ShadowsocksTidalabController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Controllers/Server/ShadowsocksTidalabController.php b/app/Http/Controllers/Server/ShadowsocksTidalabController.php index 24fcef08..b7f69583 100644 --- a/app/Http/Controllers/Server/ShadowsocksTidalabController.php +++ b/app/Http/Controllers/Server/ShadowsocksTidalabController.php @@ -9,7 +9,6 @@ use App\Utils\CacheKey; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Models\User; -use App\Models\ServerTrojan; use App\Models\ServerLog; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; @@ -91,7 +90,7 @@ class ShadowsocksTidalabController extends Controller $item['u'], $item['d'], $server->rate, - 'trojan' + 'shadowsocks' ); } DB::commit();