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