68 lines
2.4 KiB
PHP
68 lines
2.4 KiB
PHP
<?php
|
|
|
|
if (! function_exists('get_smartproxy_rotating_server')) {
|
|
function get_smartproxy_rotating_server()
|
|
{
|
|
$proxy = config('platform.proxy.smartproxy.rotating_global.server');
|
|
$proxy_user = config('platform.proxy.smartproxy.rotating_global.user');
|
|
$proxy_psw = config('platform.proxy.smartproxy.rotating_global.password');
|
|
|
|
$reproxy_enable = config('platform.proxy.smartproxy.rotating_global.reproxy_enable');
|
|
if ($reproxy_enable) {
|
|
$proxy = config('platform.proxy.smartproxy.rotating_global.reproxy');
|
|
}
|
|
$proxy_server = "$proxy_user:$proxy_psw@$proxy";
|
|
|
|
return $proxy_server;
|
|
}
|
|
}
|
|
|
|
if (! function_exists('get_smartproxy_unblocker_server')) {
|
|
function get_smartproxy_unblocker_server()
|
|
{
|
|
$proxy = config('platform.proxy.smartproxy.unblocker.server');
|
|
$proxy_user = config('platform.proxy.smartproxy.unblocker.user');
|
|
$proxy_psw = config('platform.proxy.smartproxy.unblocker.password');
|
|
|
|
$reproxy_enable = config('platform.proxy.smartproxy.unblocker.reproxy_enable');
|
|
if ($reproxy_enable) {
|
|
$proxy = config('platform.proxy.smartproxy.unblocker.reproxy');
|
|
}
|
|
$proxy_server = "$proxy_user:$proxy_psw@$proxy";
|
|
|
|
return $proxy_server;
|
|
}
|
|
}
|
|
|
|
if (! function_exists('get_smartproxy_server')) {
|
|
function get_smartproxy_server()
|
|
{
|
|
$proxy = config('platform.proxy.smartproxy.rotating_global.server');
|
|
$proxy_user = config('platform.proxy.smartproxy.rotating_global.user');
|
|
$proxy_psw = config('platform.proxy.smartproxy.rotating_global.password');
|
|
|
|
$reproxy_enable = config('platform.proxy.smartproxy.rotating_global.reproxy_enable');
|
|
if ($reproxy_enable) {
|
|
$proxy = config('platform.proxy.smartproxy.rotating_global.reproxy');
|
|
}
|
|
$proxy_server = "$proxy_user:$proxy_psw@$proxy";
|
|
|
|
return $proxy_server;
|
|
}
|
|
}
|
|
|
|
if (! function_exists('calculate_smartproxy_cost')) {
|
|
function calculate_smartproxy_cost(float $kb, $amplifier = 1)
|
|
{
|
|
$cost_per_gb = config('platform.proxy.smartproxy.rotating_global.cost_per_gb');
|
|
|
|
// Convert cost per GB to cost per KB
|
|
$cost_per_kb = $cost_per_gb / (1024 * 1024);
|
|
|
|
// Calculate total cost for the given $kb
|
|
$cost = ($cost_per_kb * $kb) * $amplifier;
|
|
|
|
return round($cost, 3);
|
|
}
|
|
}
|