. * * @link https://www.librenms.org * * @copyright 2022 Tony Murray * @author Tony Murray */ namespace LibreNMS\Util; use Illuminate\Http\Client\PendingRequest; use Illuminate\Support\Facades\Http as LaravelHttp; use LibreNMS\Config; class Http { /** * Create a new client with proxy set if appropriate and a distinct User-Agent header */ public static function client(): PendingRequest { return LaravelHttp::withOptions([ 'proxy' => [ 'http' => Proxy::http(), 'https' => Proxy::https(), 'no' => Proxy::ignore(), ], ])->withHeaders([ 'User-Agent' => Config::get('project_name') . '/' . Version::VERSION, // we don't need fine version here, just rough ]); } }