mirror of
https://github.com/v2board/v2board.git
synced 2025-07-06 20:09:08 +08:00
尝试增加ClashMeta的hy2订阅,调整hy数据库以储存混淆obfs
This commit is contained in:
@ -4,6 +4,7 @@ namespace App\Http\Controllers\V1\Admin\Server;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ServerHysteria;
|
||||
use App\Utils\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HysteriaController extends Controller
|
||||
@ -24,10 +25,18 @@ class HysteriaController extends Controller
|
||||
'rate' => 'required|numeric',
|
||||
'up_mbps' => 'required|numeric|min:1',
|
||||
'down_mbps' => 'required|numeric|min:1',
|
||||
'obfs' => 'nullable',
|
||||
'obfs_password' => 'nullable',
|
||||
'server_name' => 'nullable',
|
||||
'insecure' => 'required|in:0,1'
|
||||
]);
|
||||
|
||||
if(isset($params['obfs'])) {
|
||||
if(!isset($params['obfs_password'])) $params['obfs_password'] = Helper::getServerKey($request->input('created_at'), 16);
|
||||
} else {
|
||||
$params['obfs_password'] = null;
|
||||
}
|
||||
|
||||
if ($request->input('id')) {
|
||||
$server = ServerHysteria::find($request->input('id'));
|
||||
if (!$server) {
|
||||
|
@ -28,6 +28,7 @@ class UniProxyController extends Controller
|
||||
}
|
||||
$this->nodeType = $request->input('node_type');
|
||||
if ($this->nodeType === 'v2ray') $this->nodeType = 'vmess';
|
||||
if ($this->nodeType === 'hysteria2') $this->nodeType = 'hysteria';
|
||||
$this->nodeId = $request->input('node_id');
|
||||
$this->serverService = new ServerService();
|
||||
$this->nodeInfo = $this->serverService->getServer($this->nodeId, $this->nodeType);
|
||||
@ -118,9 +119,14 @@ class UniProxyController extends Controller
|
||||
'server_port' => $this->nodeInfo->server_port,
|
||||
'server_name' => $this->nodeInfo->server_name,
|
||||
'up_mbps' => $this->nodeInfo->up_mbps,
|
||||
'down_mbps' => $this->nodeInfo->down_mbps,
|
||||
'obfs' => Helper::getServerKey($this->nodeInfo->created_at, 16)
|
||||
'down_mbps' => $this->nodeInfo->down_mbps
|
||||
];
|
||||
if ($this->nodeInfo->version == 1) {
|
||||
$response['obfs'] = $this->nodeInfo->obfs_password ?? null;
|
||||
} elseif ($this->nodeInfo->version == 2) {
|
||||
$response['obfs'] = $this->nodeInfo->obfs ?? null;
|
||||
$response['obfs-password'] = $this->nodeInfo->obfs_password ?? null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
$response['base_config'] = [
|
||||
|
Reference in New Issue
Block a user