mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
为v2rayn的订阅添加hysteria2支持
This commit is contained in:
parent
aa63664892
commit
0000c071e7
@ -36,6 +36,9 @@ class V2rayN
|
||||
if ($item['type'] === 'trojan') {
|
||||
$uri .= self::buildTrojan($user['uuid'], $item);
|
||||
}
|
||||
if ($item['type'] === 'hysteria') {
|
||||
$uri .= self::buildHysteria($user['uuid'], $item);
|
||||
}
|
||||
|
||||
}
|
||||
return base64_encode($uri);
|
||||
@ -199,4 +202,20 @@ class V2rayN
|
||||
return $uri;
|
||||
}
|
||||
|
||||
public static function buildHysteria($password, $server)
|
||||
{
|
||||
$name = rawurlencode($server['name']);
|
||||
if ($server['server_name']) $params = ['sni' => $server['server_name']];
|
||||
$params['insecure'] = $server['insecure'] ? 1 : 0;
|
||||
$query = http_build_query($params);
|
||||
if ($server['version'] == 2) {
|
||||
$uri = "hysteria2://{$password}@{$server['host']}:{$server['port']}?{$query}#{$name}";
|
||||
$uri .= "\r\n";
|
||||
} else {
|
||||
// V2rayN似乎不支持v1, 返回空
|
||||
$uri = "";
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user