mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 12:07:28 +08:00
add anytls support
This commit is contained in:
+22
-1
@@ -76,6 +76,10 @@ class Stash implements ProtocolInterface
|
||||
array_push($proxy, self::buildTuic($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
if ($item['type'] === 'anytls') {
|
||||
array_push($proxy, self::buildAnyTLS($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
}
|
||||
if ($item['type'] === 'socks') {
|
||||
array_push($proxy, self::buildSocks5($user['uuid'], $item));
|
||||
array_push($proxies, $item['name']);
|
||||
@@ -213,7 +217,7 @@ class Stash implements ProtocolInterface
|
||||
break;
|
||||
case 2:
|
||||
$array['tls'] = true;
|
||||
$array['reality-opts']= [
|
||||
$array['reality-opts'] = [
|
||||
'public-key' => data_get($protocol_settings, 'reality_settings.public_key'),
|
||||
'short-id' => data_get($protocol_settings, 'reality_settings.short_id')
|
||||
];
|
||||
@@ -333,6 +337,23 @@ class Stash implements ProtocolInterface
|
||||
return $array;
|
||||
}
|
||||
|
||||
public static function buildAnyTLS($password, $server)
|
||||
{
|
||||
$protocol_settings = $server['protocol_settings'];
|
||||
$array = [
|
||||
'name' => $server['name'],
|
||||
'type' => 'anytls',
|
||||
'server' => $server['host'],
|
||||
'port' => $server['port'],
|
||||
'password' => $password,
|
||||
'sni' => data_get($protocol_settings, 'tls_settings.server_name'),
|
||||
'skip-cert-verify' => (bool) data_get($protocol_settings, 'tls_settings.allow_insecure', false),
|
||||
'udp' => true,
|
||||
];
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
public static function buildSocks5($password, $server)
|
||||
{
|
||||
$protocol_settings = $server['protocol_settings'];
|
||||
|
||||
Reference in New Issue
Block a user