mirror of
https://github.com/v2board/v2board.git
synced 2025-02-24 22:30:29 +08:00
Merge branch 'dev' of https://github.com/v2board/v2board into dev
This commit is contained in:
commit
7eb5532c30
@ -53,6 +53,17 @@ class ClientController extends Controller
|
||||
$uri = '';
|
||||
foreach ($server as $item) {
|
||||
$uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
|
||||
if ($item->tls) {
|
||||
$tlsSettings = json_decode($item->tlsSettings);
|
||||
$uri .= ', obfs=over-tls';
|
||||
if (isset($tlsSettings->allowInsecure)) {
|
||||
// Default: tls-verification=true
|
||||
$uri .= ', tls-verification=' . ($tlsSettings->allowInsecure ? "false" : "true");
|
||||
}
|
||||
if (isset($tlsSettings->serverName)) {
|
||||
$uri .= ', obfs-host=' . $tlsSettings->serverName;
|
||||
}
|
||||
}
|
||||
if ($item->network == 'ws') {
|
||||
$uri .= ', obfs=' . ($item->tls ? 'wss' : 'ws');
|
||||
if ($item->networkSettings) {
|
||||
@ -106,7 +117,7 @@ class ClientController extends Controller
|
||||
$tlsSettings = json_decode($item->tlsSettings);
|
||||
$proxies .= ', tls=' . ($item->tls ? "true" : "false");
|
||||
if (isset($tlsSettings->allowInsecure)) {
|
||||
$proxies .= ', skip-cert-verify=true';
|
||||
$proxies .= ', skip-cert-verify=' . ($tlsSettings->allowInsecure ? "true" : "false");
|
||||
}
|
||||
}
|
||||
if ($item->network == 'ws') {
|
||||
@ -162,8 +173,9 @@ class ClientController extends Controller
|
||||
$array['alterId'] = $user->v2ray_alter_id;
|
||||
$array['cipher'] = 'auto';
|
||||
if ($item->tls) {
|
||||
$tlsSettings = json_decode($item->tlsSettings);
|
||||
$array['tls'] = true;
|
||||
$array['skip-cert-verify'] = true;
|
||||
if (isset($tlsSettings->allowInsecure)) $array['skip-cert-verify'] = ($tlsSettings->allowInsecure ? true : false );
|
||||
}
|
||||
if ($item->network == 'ws') {
|
||||
$array['network'] = $item->network;
|
||||
|
@ -17,6 +17,13 @@ class PoseidonController extends Controller
|
||||
{
|
||||
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"sniffing":{"enabled": true,"destOverride": ["http","tls"]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"outboundDetour":[{"protocol":"blackhole","settings":{},"tag":"block"}],"routing":{"rules":[{"inboundTag":"api","outboundTag":"api","type":"field"}]},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
|
||||
|
||||
public $poseidonVersion;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->poseidonVersion = $request->input('poseidon_version');
|
||||
}
|
||||
|
||||
// 后端获取用户
|
||||
public function user(Request $request)
|
||||
{
|
||||
@ -100,6 +107,20 @@ class PoseidonController extends Controller
|
||||
$json->poseidon = [
|
||||
'license_key' => (string)config('v2board.server_license'),
|
||||
];
|
||||
if ($this->poseidonVersion >= 'v1.5.0') {
|
||||
// don't need it after v1.5.0
|
||||
unset($json->inboundDetour);
|
||||
unset($json->stats);
|
||||
unset($json->api);
|
||||
array_shift($json->routing->rules);
|
||||
}
|
||||
|
||||
foreach($json->policy->levels as &$level) {
|
||||
$level->handshake = 2;
|
||||
$level->uplinkOnly = 2;
|
||||
$level->downlinkOnly = 2;
|
||||
$level->connIdle = 60;
|
||||
}
|
||||
|
||||
return $this->success($json);
|
||||
} catch (\Exception $e) {
|
||||
|
@ -73,7 +73,10 @@ class TutorialController extends Controller
|
||||
array('-', '_', ''),
|
||||
base64_encode($response['data']['safe_area_var']['subscribe_url'])
|
||||
);
|
||||
// end
|
||||
// end
|
||||
// fuck support surge urlencode subscribe
|
||||
$response['data']['safe_area_var']['ue_subscribe_url'] = urlencode($response['data']['safe_area_var']['subscribe_url']);
|
||||
// end
|
||||
return response($response);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user