mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
Add to General: standard uri-scheme
This commit is contained in:
parent
61f1d8a623
commit
f1d55ae202
@ -33,6 +33,9 @@ class General
|
||||
if ($item['type'] === 'trojan') {
|
||||
$uri .= self::buildTrojan($user['uuid'], $item);
|
||||
}
|
||||
if ($item['type'] === 'hysteria') {
|
||||
$uri .= self::buildHysteria($user['uuid'], $item);
|
||||
}
|
||||
}
|
||||
return base64_encode($uri);
|
||||
}
|
||||
@ -110,4 +113,22 @@ class General
|
||||
return $uri;
|
||||
}
|
||||
|
||||
public static function buildHysteria($password, $server)
|
||||
{
|
||||
$name = rawurlencode($server['name']);
|
||||
$query = http_build_query([
|
||||
'protocol' => 'udp',
|
||||
'auth' => $password,
|
||||
'insecure' => $server['insecure'],
|
||||
'peer' => $server['server_name'],
|
||||
'upmbps' => $server['up_mbps'],
|
||||
'downmbps' => $server['up_mbps'],
|
||||
'alpn' => 'h3',
|
||||
'obfsParam' => $server['server_key']
|
||||
]);
|
||||
$uri = "hysteria://{$server['host']}:{$server['port']}?{$query}#{$name}";
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user