mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-23 19:37:35 +08:00
feat: Add TUIC protocol support and fix user filtering/export issues
This commit is contained in:
@@ -80,6 +80,10 @@ class SingBox implements ProtocolInterface
|
||||
$hysteriaConfig = $this->buildHysteria($this->user['uuid'], $item);
|
||||
$proxies[] = $hysteriaConfig;
|
||||
}
|
||||
if ($item['type'] === 'tuic') {
|
||||
$tuicConfig = $this->buildTuic($this->user['uuid'], $item);
|
||||
$proxies[] = $tuicConfig;
|
||||
}
|
||||
}
|
||||
foreach ($outbounds as &$outbound) {
|
||||
if (in_array($outbound['type'], ['urltest', 'selector'])) {
|
||||
@@ -324,4 +328,37 @@ class SingBox implements ProtocolInterface
|
||||
$versionConfig
|
||||
);
|
||||
}
|
||||
|
||||
protected function buildTuic($password, $server): array
|
||||
{
|
||||
$protocol_settings = data_get($server, 'protocol_settings', []);
|
||||
$array = [
|
||||
'type' => 'tuic',
|
||||
'tag' => $server['name'],
|
||||
'server' => $server['host'],
|
||||
'server_port' => $server['port'],
|
||||
'congestion_control' => data_get($protocol_settings, 'congestion_control', 'cubic'),
|
||||
'udp_relay_mode' => data_get($protocol_settings, 'udp_relay_mode', 'native'),
|
||||
'zero_rtt_handshake' => true,
|
||||
'heartbeat' => '10s',
|
||||
'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;
|
||||
}
|
||||
|
||||
if (data_get($protocol_settings, 'version') === 4) {
|
||||
$array['token'] = $password;
|
||||
} else {
|
||||
$array['uuid'] = $password;
|
||||
$array['password'] = $password;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user