add anytls support
This commit is contained in:
1 parent
497fe59986
commit
0f672571b7
8 files changed
+148
-3
No files matched your search
@@ -83,6 +83,10 @@ class SingBox implements ProtocolInterface
|
||||
$tuicConfig = $this->buildTuic($this->user['uuid'], $item);
|
||||
$proxies[] = $tuicConfig;
|
||||
}
|
||||
if ($item['type'] === 'anytls') {
|
||||
$anytlsConfig = $this->buildAnyTLS($this->user['uuid'], $item);
|
||||
$proxies[] = $anytlsConfig;
|
||||
}
|
||||
if ($item['type'] === 'socks') {
|
||||
$socksConfig = $this->buildSocks($this->user['uuid'], $item);
|
||||
$proxies[] = $socksConfig;
|
||||
@@ -372,6 +376,29 @@ class SingBox implements ProtocolInterface
|
||||
return $array;
|
||||
}
|
||||
|
||||
protected function buildAnyTLS($password, $server): array
|
||||
{
|
||||
$protocol_settings = data_get($server, 'protocol_settings', []);
|
||||
$array = [
|
||||
'type' => 'anytls',
|
||||
'tag' => $server['name'],
|
||||
'server' => $server['host'],
|
||||
'password' => $password,
|
||||
'server_port' => $server['port'],
|
||||
'tls' => [
|
||||
'enabled' => true,
|
||||
'insecure' => (bool) data_get($protocol_settings, 'tls.allow_insecure', false),
|
||||
'alpn' => data_get($protocol_settings, 'alpn', ['h3']),
|
||||
]
|
||||
];
|
||||
|
||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
||||
$array['tls']['server_name'] = $serverName;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
protected function buildSocks($password, $server): array
|
||||
{
|
||||
$protocol_settings = data_get($server, 'protocol_settings', []);
|
||||
|
||||
Reference in new issue
Block a user