mirror of
https://github.com/v2board/v2board.git
synced 2025-07-03 10:33:21 +08:00
尝试修正ws和reality订阅
This commit is contained in:
@ -40,6 +40,9 @@ class VlessController extends Controller
|
||||
if (!isset($params['tls_settings']['private_key'])) {
|
||||
$params['tls_settings']['private_key'] = Helper::base64EncodeUrlSafe(SodiumCompat::crypto_box_secretkey($keyPair));
|
||||
}
|
||||
if (!isset($params['tls_settings']['shortId'])) {
|
||||
$params['tls_settings']['shortId'] = substr(sha1(time()), 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->input('id')) {
|
||||
|
@ -181,14 +181,43 @@ class ClashMeta
|
||||
if ($server['tls_settings']) {
|
||||
$tlsSettings = $server['tls_settings'];
|
||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||
$array['servername'] = $tlsSettings['server_name'];
|
||||
$array['servername'] = $tlsSettings['server_name'];
|
||||
if ($server['tls'] == 2) {
|
||||
$array['reality-opts'] = [];
|
||||
$array['reality-opts']['public-key'] = $tlsSettings['public_key'];
|
||||
$array['reality-opts']['short-id'] = $tlsSettings['shortId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($server['network'] === 'tcp') {
|
||||
$tcpSettings = $server['network_settings'];
|
||||
}
|
||||
//ws和grpc需要继续修
|
||||
|
||||
if ($server['network'] === 'ws') {
|
||||
$array['network'] = 'ws';
|
||||
if ($server['network_settings']) {
|
||||
$wsSettings = $server['network_settings'];
|
||||
$array['ws-opts'] = [];
|
||||
if (isset($wsSettings['path']) && !empty($wsSettings['path']))
|
||||
$array['ws-opts']['path'] = $wsSettings['path'];
|
||||
if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))
|
||||
$array['ws-opts']['headers'] = ['Host' => $wsSettings['headers']['Host']];
|
||||
if (isset($wsSettings['path']) && !empty($wsSettings['path']))
|
||||
$array['ws-path'] = $wsSettings['path'];
|
||||
if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))
|
||||
$array['ws-headers'] = ['Host' => $wsSettings['headers']['Host']];
|
||||
}
|
||||
}
|
||||
if ($server['network'] === 'grpc') {
|
||||
$array['network'] = 'grpc';
|
||||
if ($server['network_settings']) {
|
||||
$grpcSettings = $server['network_settings'];
|
||||
$array['grpc-opts'] = [];
|
||||
if (isset($grpcSettings['serviceName'])) $array['grpc-opts']['grpc-service-name'] = $grpcSettings['serviceName'];
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
@ -108,20 +108,25 @@ class General
|
||||
"add" => $server['host'],
|
||||
"port" => (string)$server['port'],
|
||||
"id" => $uuid,
|
||||
"aid" => '0',
|
||||
"net" => $server['network'],
|
||||
"type" => "none",
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $server['tls'] ? "tls" : "",
|
||||
"tls" => $server['tls'] !=0 ? ($server['tls'] == 2 ? "reality":"tls") : "",
|
||||
"flow" => $server['flow'],
|
||||
"sni" => "",
|
||||
"pbk" => "",
|
||||
"sid" =>"",
|
||||
];
|
||||
if ($server['tls']) {
|
||||
if ($server['tls_settings']) {
|
||||
$tlsSettings = $server['tls_settings'];
|
||||
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
|
||||
$config['sni'] = $tlsSettings['serverName'];
|
||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||
$config['sni'] = $tlsSettings['server_name'];
|
||||
if ($server['tls'] == 2) {
|
||||
$config['pbk'] = $tlsSettings['public_key'];
|
||||
$config['sid'] = $tlsSettings['shortId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((string)$server['network'] === 'tcp') {
|
||||
@ -138,8 +143,12 @@ class General
|
||||
$grpcSettings = $server['network_settings'];
|
||||
if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName'];
|
||||
}
|
||||
//reality需要继续修
|
||||
return "vless://{$uuid}@{$server['host']}:{$server['port']}?security={$config['tls']}&encryption=none&headerType={$config['type']}&type={$server['network']}&flow={$server['flow']}&fp=chrome#${server['name']}" . "\r\n";
|
||||
//grpc需要继续修
|
||||
if ($server['tls'] == 2) {
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}&pbk={$config['pbk']}&sid={$config['sid']}#${config['ps']}" . "\r\n";
|
||||
|
||||
}
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}#${config['ps']}" . "\r\n";
|
||||
}
|
||||
|
||||
public static function buildTrojan($password, $server)
|
||||
|
@ -122,7 +122,6 @@ class Shadowrocket
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
}
|
||||
|
||||
public static function buildVless($uuid, $server)
|
||||
{
|
||||
$config = [
|
||||
@ -131,20 +130,25 @@ class Shadowrocket
|
||||
"add" => $server['host'],
|
||||
"port" => (string)$server['port'],
|
||||
"id" => $uuid,
|
||||
"aid" => '0',
|
||||
"net" => $server['network'],
|
||||
"type" => "none",
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $server['tls'] ? "tls" : "",
|
||||
"tls" => $server['tls'] !=0 ? ($server['tls'] == 2 ? "reality":"tls") : "",
|
||||
"flow" => $server['flow'],
|
||||
"sni" => "",
|
||||
"pbk" => "",
|
||||
"sid" =>"",
|
||||
];
|
||||
if ($server['tls']) {
|
||||
if ($server['tls_settings']) {
|
||||
$tlsSettings = $server['tls_settings'];
|
||||
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
|
||||
$config['sni'] = $tlsSettings['serverName'];
|
||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||
$config['sni'] = $tlsSettings['server_name'];
|
||||
if ($server['tls'] == 2) {
|
||||
$config['pbk'] = $tlsSettings['public_key'];
|
||||
$config['sid'] = $tlsSettings['shortId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((string)$server['network'] === 'tcp') {
|
||||
@ -161,8 +165,12 @@ class Shadowrocket
|
||||
$grpcSettings = $server['network_settings'];
|
||||
if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName'];
|
||||
}
|
||||
//realit继续修
|
||||
return "vless://{$uuid}@{$server['host']}:{$server['port']}?security={$config['tls']}&encryption=none&headerType={$config['type']}&type={$server['network']}&flow={$server['flow']}&fp=chrome#${server['name']}" . "\r\n";
|
||||
//grpc需要继续修
|
||||
if ($server['tls'] == 2) {
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}&pbk={$config['pbk']}&sid={$config['sid']}#${config['ps']}" . "\r\n";
|
||||
|
||||
}
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}#${config['ps']}" . "\r\n";
|
||||
}
|
||||
|
||||
public static function buildTrojan($password, $server)
|
||||
|
@ -108,20 +108,25 @@ class V2rayN
|
||||
"add" => $server['host'],
|
||||
"port" => (string)$server['port'],
|
||||
"id" => $uuid,
|
||||
"aid" => '0',
|
||||
"net" => $server['network'],
|
||||
"type" => "none",
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $server['tls'] ? "tls" : "",
|
||||
"tls" => $server['tls'] !=0 ? ($server['tls'] == 2 ? "reality":"tls") : "",
|
||||
"flow" => $server['flow'],
|
||||
"sni" => "",
|
||||
"pbk" => "",
|
||||
"sid" =>"",
|
||||
];
|
||||
if ($server['tls']) {
|
||||
if ($server['tls_settings']) {
|
||||
$tlsSettings = $server['tls_settings'];
|
||||
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
|
||||
$config['sni'] = $tlsSettings['serverName'];
|
||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||
$config['sni'] = $tlsSettings['server_name'];
|
||||
if ($server['tls'] == 2) {
|
||||
$config['pbk'] = $tlsSettings['public_key'];
|
||||
$config['sid'] = $tlsSettings['shortId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((string)$server['network'] === 'tcp') {
|
||||
@ -138,8 +143,12 @@ class V2rayN
|
||||
$grpcSettings = $server['network_settings'];
|
||||
if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName'];
|
||||
}
|
||||
//reality继续修
|
||||
return "vless://{$uuid}@{$server['host']}:{$server['port']}?security={$config['tls']}&encryption=none&headerType={$config['type']}&type={$server['network']}&flow={$server['flow']}&fp=chrome#${server['name']}" . "\r\n";
|
||||
//grpc需要继续修
|
||||
if ($server['tls'] == 2) {
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}&pbk={$config['pbk']}&sid={$config['sid']}#${config['ps']}" . "\r\n";
|
||||
|
||||
}
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}#${config['ps']}" . "\r\n";
|
||||
}
|
||||
|
||||
public static function buildTrojan($password, $server)
|
||||
|
@ -96,20 +96,25 @@ class V2rayNG
|
||||
"add" => $server['host'],
|
||||
"port" => (string)$server['port'],
|
||||
"id" => $uuid,
|
||||
"aid" => '0',
|
||||
"net" => $server['network'],
|
||||
"type" => "none",
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $server['tls'] ? "tls" : "",
|
||||
"tls" => $server['tls'] !=0 ? ($server['tls'] == 2 ? "reality":"tls") : "",
|
||||
"flow" => $server['flow'],
|
||||
"sni" => "",
|
||||
"pbk" => "",
|
||||
"sid" =>"",
|
||||
];
|
||||
if ($server['tls']) {
|
||||
if ($server['tls_settings']) {
|
||||
$tlsSettings = $server['tls_settings'];
|
||||
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
|
||||
$config['sni'] = $tlsSettings['serverName'];
|
||||
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
|
||||
$config['sni'] = $tlsSettings['server_name'];
|
||||
if ($server['tls'] == 2) {
|
||||
$config['pbk'] = $tlsSettings['public_key'];
|
||||
$config['sid'] = $tlsSettings['shortId'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((string)$server['network'] === 'tcp') {
|
||||
@ -126,10 +131,13 @@ class V2rayNG
|
||||
$grpcSettings = $server['network_settings'];
|
||||
if (isset($grpcSettings['serviceName'])) $config['path'] = $grpcSettings['serviceName'];
|
||||
}
|
||||
//reality继续修
|
||||
return "vless://{$uuid}@{$server['host']}:{$server['port']}?security={$config['tls']}&encryption=none&headerType={$config['type']}&type={$server['network']}&flow={$server['flow']}&fp=chrome#${server['name']}" . "\r\n";
|
||||
}
|
||||
//grpc需要继续修
|
||||
if ($server['tls'] == 2) {
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}&pbk={$config['pbk']}&sid={$config['sid']}#${config['ps']}" . "\r\n";
|
||||
|
||||
}
|
||||
return "vless://{$uuid}@{$config['add']}:{$server['port']}?type={$config['net']}&encryption=none&security={$config['tls']}&path={$config['path']}&host={$config['host']}&headerType={$config['type']}&flow={$server['flow']}&fp=chrome&sni={$config['sni']}#${config['ps']}" . "\r\n";
|
||||
}
|
||||
|
||||
public static function buildTrojan($password, $server)
|
||||
{
|
||||
|
Reference in New Issue
Block a user