mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
Compare commits
2 Commits
96df9305b6
...
1f4367637e
Author | SHA1 | Date | |
---|---|---|---|
|
1f4367637e | ||
|
c3135d5ba9 |
@ -146,7 +146,7 @@ class Loon implements ProtocolInterface
|
|||||||
'udp=true'
|
'udp=true'
|
||||||
];
|
];
|
||||||
if (!empty($protocol_settings['allow_insecure'])) {
|
if (!empty($protocol_settings['allow_insecure'])) {
|
||||||
array_push($config, data_get($protocol_settings, 'tls_settings')['allow_insecure'] ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
array_push($config, data_get($protocol_settings, 'allow_insecure') ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||||
}
|
}
|
||||||
$config = array_filter($config);
|
$config = array_filter($config);
|
||||||
$uri = implode(',', $config);
|
$uri = implode(',', $config);
|
||||||
@ -154,6 +154,59 @@ class Loon implements ProtocolInterface
|
|||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function buildVless($uuid, $server)
|
||||||
|
{
|
||||||
|
$protocol_settings = $server['protocol_settings'];
|
||||||
|
$config = [
|
||||||
|
"{$server['name']}=vless",
|
||||||
|
$server['host'],
|
||||||
|
$server['port'],
|
||||||
|
$uuid,
|
||||||
|
'fast-open=false',
|
||||||
|
'udp=true',
|
||||||
|
'alterId=0'
|
||||||
|
];
|
||||||
|
switch ((int) data_get($protocol_settings, 'tls')) {
|
||||||
|
case 1:
|
||||||
|
$config[] = 'over-tls=true';
|
||||||
|
$tlsSettings = data_get($protocol_settings, 'tls_settings', []);
|
||||||
|
if ($tlsSettings) {
|
||||||
|
$config[] = 'skip-cert-verify=' . (data_get($tlsSettings, 'allow_insecure') ? 'true' : 'false');
|
||||||
|
if ($serverName = data_get($tlsSettings, 'server_name')) {
|
||||||
|
$config[] = "tls-name={$serverName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$network_settings = data_get($protocol_settings, 'network_settings', []);
|
||||||
|
switch ((string) data_get($network_settings, 'network')) {
|
||||||
|
case 'tcp':
|
||||||
|
$config[] = 'transport=tcp';
|
||||||
|
if ($headerType = data_get($network_settings, 'header.type')) {
|
||||||
|
$config = collect($config)->map(function ($item) use ($headerType) {
|
||||||
|
return $item === 'transport=tcp' ? "transport={$headerType}" : $item;
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
if ($paths = data_get($network_settings, 'header.request.path')) {
|
||||||
|
$config[] = 'path=' . $paths[array_rand($paths)];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'ws':
|
||||||
|
$config[] = 'transport=ws';
|
||||||
|
if ($path = data_get($network_settings, 'path')) {
|
||||||
|
$config[] = "path={$path}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($host = data_get($network_settings, 'headers.Host')) {
|
||||||
|
$config[] = "host={$host}";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return implode(',', $config) . "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
public static function buildHysteria($password, $server, $user)
|
public static function buildHysteria($password, $server, $user)
|
||||||
{
|
{
|
||||||
$protocol_settings = $server['protocol_settings'];
|
$protocol_settings = $server['protocol_settings'];
|
||||||
|
@ -197,8 +197,8 @@ class Shadowrocket implements ProtocolInterface
|
|||||||
{
|
{
|
||||||
$protocol_settings = $server['protocol_settings'];
|
$protocol_settings = $server['protocol_settings'];
|
||||||
$name = rawurlencode($server['name']);
|
$name = rawurlencode($server['name']);
|
||||||
$params['allowInsecure'] = data_get($protocol_settings, 'tls.allow_insecure');
|
$params['allowInsecure'] = data_get($protocol_settings, 'allow_insecure');
|
||||||
if ($serverName = data_get($protocol_settings, 'tls.server_name')) {
|
if ($serverName = data_get($protocol_settings, 'server_name')) {
|
||||||
$params['peer'] = $serverName;
|
$params['peer'] = $serverName;
|
||||||
}
|
}
|
||||||
switch (data_get($protocol_settings, 'network')) {
|
switch (data_get($protocol_settings, 'network')) {
|
||||||
|
Loading…
Reference in New Issue
Block a user