mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 03:57:27 +08:00
feat: 增加surge的hy2下发、添加clash meta、shadowrocket、stash订阅hy2端口跳跃的下发
This commit is contained in:
@@ -52,6 +52,12 @@ class Surge
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
if ($item['type'] === 'hysteria') {
|
||||
// [Proxy]
|
||||
$proxies .= self::buildHysteria($user['uuid'], $item);
|
||||
// [Proxy Group]
|
||||
$proxyGroup .= $item['name'] . ', ';
|
||||
}
|
||||
}
|
||||
|
||||
$defaultConfig = base_path() . '/resources/rules/default.surge.conf';
|
||||
@@ -160,4 +166,27 @@ class Surge
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
}
|
||||
|
||||
//参考文档: https://manual.nssurge.com/policy/proxy.html
|
||||
public static function buildHysteria($password, $server)
|
||||
{
|
||||
if($server['version'] != 2) return '';
|
||||
$config = [
|
||||
"{$server['name']}=hysteria2",
|
||||
"{$server['host']}",
|
||||
"{$server['port']}",
|
||||
"password={$password}",
|
||||
"download-bandwidth={$server['up_mbps']}",
|
||||
$server['server_name'] ? "sni={$server['server_name']}" : "",
|
||||
// 'tfo=true',
|
||||
'udp-relay=true'
|
||||
];
|
||||
if ($server['insecure']) {
|
||||
$config[] = $server['insecure'] ? 'skip-cert-verify=true' : 'skip-cert-verify=false';
|
||||
}
|
||||
$config = array_filter($config);
|
||||
$uri = implode(',', $config);
|
||||
$uri .= "\r\n";
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user