mirror of
https://github.com/rekryt/iplist.git
synced 2025-10-13 00:49:36 +03:00
feat: add new format "amnezia json" sites lists
This commit is contained in:
@@ -30,6 +30,7 @@ Demo URL: [https://iplist.opencck.org](https://iplist.opencck.org)
|
|||||||
| ipset | Dnsmasq ipset |
|
| ipset | Dnsmasq ipset |
|
||||||
| clashx | ClashX |
|
| clashx | ClashX |
|
||||||
| kvas | Keenetic KVAS |
|
| kvas | Keenetic KVAS |
|
||||||
|
| amnezia | Amnezia filter list |
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ Demo URL: [https://iplist.opencck.org](https://iplist.opencck.org)
|
|||||||
| ipset | Dnsmasq ipset |
|
| ipset | Dnsmasq ipset |
|
||||||
| clashx | ClashX |
|
| clashx | ClashX |
|
||||||
| kvas | Keenetic KVAS |
|
| kvas | Keenetic KVAS |
|
||||||
|
| amnezia | Amnezia filter list |
|
||||||
|
|
||||||
## Настройки
|
## Настройки
|
||||||
Конфигурационные файлы хранятся в `config/<группа>/<портал>.json`. Каждый JSON файл представляет собой конфигурацию для конкретного портала, задавая домены для мониторинга и источники начальных данных по IP и CIDR.
|
Конфигурационные файлы хранятся в `config/<группа>/<портал>.json`. Каждый JSON файл представляет собой конфигурацию для конкретного портала, задавая домены для мониторинга и источники начальных данных по IP и CIDR.
|
||||||
|
34
src/App/Controller/AmneziaController.php
Normal file
34
src/App/Controller/AmneziaController.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCCK\App\Controller;
|
||||||
|
|
||||||
|
use OpenCCK\Domain\Factory\SiteFactory;
|
||||||
|
|
||||||
|
class AmneziaController extends AbstractIPListController {
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getBody(): string {
|
||||||
|
$this->setHeaders(['content-type' => 'application/json']);
|
||||||
|
|
||||||
|
$sites = SiteFactory::normalizeArray($this->request->getQueryParameters()['site'] ?? []);
|
||||||
|
$data = $this->request->getQueryParameter('data') ?? '';
|
||||||
|
if ($data == '') {
|
||||||
|
return "# Error: The 'data' GET parameter is required in the URL to access this page";
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = [];
|
||||||
|
if (count($sites)) {
|
||||||
|
foreach ($sites as $site) {
|
||||||
|
$response = array_merge($response, $this->getSites()[$site]->$data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ($this->getSites() as $siteEntity) {
|
||||||
|
$response = array_merge($response, $siteEntity->$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response = SiteFactory::normalizeArray($response, in_array($data, ['ipv4', 'ipv6', 'cidr4', 'cidr6']));
|
||||||
|
|
||||||
|
return json_encode(array_map(fn(string $item) => ['hostname' => $item, 'ip' => ''], $response));
|
||||||
|
}
|
||||||
|
}
|
@@ -630,6 +630,7 @@ use OpenCCK\App\Controller\MainController;
|
|||||||
<option value="ipset">Dnsmasq ipset</option>
|
<option value="ipset">Dnsmasq ipset</option>
|
||||||
<option value="clashx">ClashX</option>
|
<option value="clashx">ClashX</option>
|
||||||
<option value="kvas">Keenetic KVAS</option>
|
<option value="kvas">Keenetic KVAS</option>
|
||||||
|
<option value="amnezia">Amnezia</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="main-formItem">
|
<label class="main-formItem">
|
||||||
|
Reference in New Issue
Block a user