mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
21 lines
469 B
PHP
21 lines
469 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use Illuminate\Support\Facades\Cache;
|
||
|
use Illuminate\Support\Facades\Storage;
|
||
|
use Symfony\Component\HttpFoundation\IpUtils;
|
||
|
|
||
|
class BouncerService
|
||
|
{
|
||
|
public static function checkIp($ip)
|
||
|
{
|
||
|
$knownCloudCidrs = Cache::rememberForever('pf:bouncer-service:check-ip:known-cloud-cidrs', function() {
|
||
|
$file = Storage::get('bouncer/all.json');
|
||
|
return json_decode($file, true);
|
||
|
});
|
||
|
|
||
|
return IpUtils::checkIp($ip, $knownCloudCidrs);
|
||
|
}
|
||
|
}
|