This commit is contained in:
Tokumeikoi 2020-11-02 22:22:48 +08:00
commit 6d9ab7dfe2
6 changed files with 64 additions and 45 deletions

View File

@ -135,7 +135,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)

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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');
}
}

View File

@ -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";