2020-10-04 14:21:09 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class ServerShadowsocksSave extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'show' => '',
|
|
|
|
'name' => 'required',
|
|
|
|
'group_id' => 'required|array',
|
|
|
|
'parent_id' => 'nullable|integer',
|
2022-11-27 15:11:10 +08:00
|
|
|
'route_id' => 'nullable|array',
|
2020-10-04 14:21:09 +08:00
|
|
|
'host' => 'required',
|
|
|
|
'port' => 'required',
|
|
|
|
'server_port' => 'required',
|
2022-11-18 02:39:28 +08:00
|
|
|
'cipher' => 'required|in:aes-128-gcm,aes-192-gcm,aes-256-gcm,chacha20-ietf-poly1305,2022-blake3-aes-128-gcm,2022-blake3-aes-256-gcm',
|
2022-05-12 02:39:59 +08:00
|
|
|
'obfs' => 'nullable|in:http',
|
|
|
|
'obfs_settings' => 'nullable|array',
|
2020-10-04 14:21:09 +08:00
|
|
|
'tags' => 'nullable|array',
|
|
|
|
'rate' => 'required|numeric'
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function messages()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'name.required' => '节点名称不能为空',
|
|
|
|
'group_id.required' => '权限组不能为空',
|
|
|
|
'group_id.array' => '权限组格式不正确',
|
2022-11-27 15:11:10 +08:00
|
|
|
'route_id.array' => '路由组格式不正确',
|
2020-10-04 14:21:09 +08:00
|
|
|
'parent_id.integer' => '父节点格式不正确',
|
|
|
|
'host.required' => '节点地址不能为空',
|
|
|
|
'port.required' => '连接端口不能为空',
|
|
|
|
'server_port.required' => '后端服务端口不能为空',
|
|
|
|
'cipher.required' => '加密方式不能为空',
|
|
|
|
'tags.array' => '标签格式不正确',
|
|
|
|
'rate.required' => '倍率不能为空',
|
2022-05-12 02:39:59 +08:00
|
|
|
'rate.numeric' => '倍率格式不正确',
|
|
|
|
'obfs.in' => '混淆格式不正确',
|
|
|
|
'obfs_settings.array' => '混淆设置格式不正确'
|
2020-10-04 14:21:09 +08:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|