fix: improve node filtering by client base_version, set subscription content-type, and add hop_interval support for hysteria2

- Refactor node filtering logic to correctly handle client base_version requirements.
- Set appropriate Content-Type header for subscription responses.
- Add support for hop_interval configuration in hysteria2 node delivery.
This commit is contained in:
xboard
2025-05-24 13:45:32 +08:00
parent a3700ad685
commit bf3a9112f2
12 changed files with 82 additions and 29 deletions
+13 -9
View File
@@ -48,6 +48,9 @@ class SingBox extends AbstractProtocol
],
'wireguard' => [
'base_version' => '1.5.0'
],
'anytls' => [
'base_version' => '1.12.0'
]
]
];
@@ -340,15 +343,16 @@ class SingBox extends AbstractProtocol
'insecure' => (bool) $protocol_settings['tls']['allow_insecure'],
]
];
Log::info($this->clientName);
Log::info($this->clientVersion);
// if (
// isset($server['ports'])
// && $this->clientName == 'sfm'
// && version_compare($this->clientVersion, '1.11.0', '>=')
// ) {
// $baseConfig['server_ports'][] = str_replace('-', ':', $server['ports']);
// }
// 支持 1.11.0 版本及以上 `server_ports` 和 `hop_interval` 配置
if ($this->supportsFeature('sing-box', '1.11.0')) {
if (isset($server['ports'])) {
$baseConfig['server_ports'] = [str_replace('-', ':', $server['ports'])];
}
if (isset($protocol_settings['hop_interval'])) {
$baseConfig['hop_interval'] = "{$protocol_settings['hop_interval']}s";
}
}
if ($serverName = data_get($protocol_settings, 'tls_settings.server_name')) {
$baseConfig['tls']['server_name'] = $serverName;
}