update trojan

This commit is contained in:
Tokumeikoi 2020-07-01 18:49:51 +08:00
parent 2d67446ce3
commit 4c457d183f
3 changed files with 7 additions and 5 deletions

View File

@ -42,7 +42,11 @@ class Clash
$array['port'] = $server->port; $array['port'] = $server->port;
$array['password'] = $password; $array['password'] = $password;
$array['sni'] = $server->server_name; $array['sni'] = $server->server_name;
$array['skip-cert-verify'] = (string)($server->allow_insecure ? true : false); if ($server->allow_insecure) {
$array['skip-cert-verify'] = true;
} else {
$array['skip-cert-verify'] = false;
}
return $array; return $array;
} }
} }

View File

@ -33,13 +33,12 @@ class QuantumultX
public static function buildTrojan($password, $server) public static function buildTrojan($password, $server)
{ {
$tlsVerification = (string)($server->allow_insecure ? true : false);
$config = [ $config = [
"trojan={$server->host}:{$server->port}", "trojan={$server->host}:{$server->port}",
"password={$password}", "password={$password}",
"over-tls=true", "over-tls=true",
$server->server_name ? "tls-host={$server->server_name}" : "", $server->server_name ? "tls-host={$server->server_name}" : "",
"tls-verification={$tlsVerification}", $server->allow_insecure ? 'tls-verification=true' : 'tls-verification=false',
"fast-open=false", "fast-open=false",
"udp-relay=false", "udp-relay=false",
"tag={$server->name}" "tag={$server->name}"

View File

@ -29,13 +29,12 @@ class Surge
public static function buildTrojan($password, $server) public static function buildTrojan($password, $server)
{ {
$skipCertVerify = (string)($server->allow_insecure ? true : false);
$config = [ $config = [
"{$server->name}=trojan", "{$server->name}=trojan",
"{$server->host}", "{$server->host}",
"{$server->port}", "{$server->port}",
"password={$password}", "password={$password}",
"skip-cert-verify={$skipCertVerify}", $server->allow_insecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false',
$server->server_name ? "sni={$server->server_name}" : "", $server->server_name ? "sni={$server->server_name}" : "",
"tfo=true" "tfo=true"
]; ];