mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-29 23:47:27 +08:00
fix(stash): fix Flow network and SNI issues
This commit is contained in:
+19
-9
@@ -18,7 +18,7 @@ class Stash extends AbstractProtocol
|
|||||||
Server::TYPE_HYSTERIA,
|
Server::TYPE_HYSTERIA,
|
||||||
Server::TYPE_TROJAN,
|
Server::TYPE_TROJAN,
|
||||||
Server::TYPE_TUIC,
|
Server::TYPE_TUIC,
|
||||||
// Server::TYPE_ANYTLS,
|
// Server::TYPE_ANYTLS,
|
||||||
Server::TYPE_SOCKS,
|
Server::TYPE_SOCKS,
|
||||||
Server::TYPE_HTTP,
|
Server::TYPE_HTTP,
|
||||||
];
|
];
|
||||||
@@ -253,6 +253,9 @@ class Stash extends AbstractProtocol
|
|||||||
case 'tcp':
|
case 'tcp':
|
||||||
$array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'http');
|
$array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'http');
|
||||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||||
|
if ($host = data_get($protocol_settings, 'network_settings.header.request.headers.Host')) {
|
||||||
|
$array['http-opts']['headers']['Host'] = $host;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
@@ -295,16 +298,24 @@ class Stash extends AbstractProtocol
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$array['tls'] = true;
|
$array['tls'] = true;
|
||||||
|
if ($serverName = data_get($protocol_settings, 'reality_settings.server_name')) {
|
||||||
|
$array['servername'] = $serverName;
|
||||||
|
$array['sni'] = $serverName;
|
||||||
|
}
|
||||||
|
$array['flow'] = data_get($protocol_settings, 'flow');
|
||||||
$array['reality-opts'] = [
|
$array['reality-opts'] = [
|
||||||
'public-key' => data_get($protocol_settings, 'reality_settings.public_key'),
|
'public-key' => data_get($protocol_settings, 'reality_settings.public_key'),
|
||||||
'short-id' => data_get($protocol_settings, 'reality_settings.short_id')
|
'short-id' => data_get($protocol_settings, 'reality_settings.short_id')
|
||||||
];
|
];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (data_get($protocol_settings, 'network')) {
|
switch (data_get($protocol_settings, 'network')) {
|
||||||
case 'tcp':
|
case 'tcp':
|
||||||
$array['network'] = data_get($protocol_settings, 'network_settings.header.type');
|
if ($headerType = data_get($protocol_settings, 'network_settings.header.type', 'tcp') != 'tcp') {
|
||||||
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
$array['network'] = $headerType;
|
||||||
|
$array['http-opts']['path'] = data_get($protocol_settings, 'network_settings.header.request.path', ['/']);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
@@ -317,11 +328,11 @@ class Stash extends AbstractProtocol
|
|||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
$array['grpc-opts']['grpc-service-name'] = data_get($protocol_settings, 'network_settings.serviceName');
|
$array['grpc-opts']['grpc-service-name'] = data_get($protocol_settings, 'network_settings.serviceName');
|
||||||
break;
|
break;
|
||||||
// case 'h2':
|
// case 'h2':
|
||||||
// $array['network'] = 'h2';
|
// $array['network'] = 'h2';
|
||||||
// $array['h2-opts']['host'] = data_get($protocol_settings, 'network_settings.host');
|
// $array['h2-opts']['host'] = data_get($protocol_settings, 'network_settings.host');
|
||||||
// $array['h2-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
// $array['h2-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
@@ -384,7 +395,6 @@ class Stash extends AbstractProtocol
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function buildTuic($password, $server)
|
public static function buildTuic($password, $server)
|
||||||
|
|||||||
Reference in New Issue
Block a user