Merge pull request #180 from ishkong/patch-1

feat: 支持部分客户端订阅获取shadowsocks中obfs部分参数
This commit is contained in:
Xboard 2024-07-21 17:48:17 +08:00 committed by GitHub
commit 5f3b95b699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -58,7 +58,11 @@ class Shadowrocket
['-', '_', ''],
base64_encode("{$server['cipher']}:{$password}")
);
return "ss://{$str}@{$server['host']}:{$server['port']}#{$name}\r\n";
$uri = "ss://{$str}@{$server['host']}:{$server['port']}";
if ($server['obfs'] == 'http') {
$uri .= "?plugin=obfs-local;obfs=http;obfs-host={$server['obfs-host']};obfs-uri={$server['obfs-path']}";
}
return $uri."#{$name}\r\n";
}
public static function buildVmess($uuid, $server)
@ -283,4 +287,4 @@ class Shadowrocket
}
return $uri;
}
}
}

View File

@ -46,7 +46,11 @@ class V2rayNG
['-', '_', ''],
base64_encode("{$server['cipher']}:{$password}")
);
return "ss://{$str}@{$server['host']}:{$server['port']}#{$name}\r\n";
$uri = "ss://{$str}@{$server['host']}:{$server['port']}";
if ($server['obfs'] == 'http') {
$uri .= "?plugin=obfs-local;obfs=http;obfs-host={$server['obfs-host']};path={$server['obfs-path']}";
}
return $uri."#{$name}\r\n";
}
public static function buildVmess($uuid, $server)

View File

@ -161,6 +161,11 @@ class ServerService
$userKey = Helper::uuidToBase64($user['uuid'], $config['userKeySize']);
$shadowsocks[$key]['password'] = "{$serverKey}:{$userKey}";
}
if ($v['obfs'] === 'http') {
$shadowsocks[$key]['obfs'] = 'http';
$shadowsocks[$key]['obfs-host'] = $v['obfs_settings']['host'];
$shadowsocks[$key]['obfs-path'] = $v['obfs_settings']['path'];
}
$servers[] = $shadowsocks[$key]->toArray();
}
return $servers;