ability to add IPs and subnets to warplist

This commit is contained in:
mercury
2025-11-26 00:50:43 +04:00
parent 9bd85c9e05
commit 2ee6c3392b
+22 -1
View File
@@ -2924,7 +2924,28 @@ DNS-over-HTTPS with IP:
$rules[] = [
"type" => "field",
"outboundTag" => "warp",
"domain" => array_keys(array_filter($c['warplist'])),
"domain" => array_keys(array_filter($c['warplist'], function ($v, $k){
if (!empty($v)) {
if (!preg_match('~^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?$~', $k)) {
return true;
}
}
return false;
}, ARRAY_FILTER_USE_BOTH)),
];
}
if (!empty($c['warplist']) && !empty(array_filter($c['warplist']))) {
$rules[] = [
"type" => "field",
"outboundTag" => "warp",
"ip" => array_keys(array_filter($c['warplist'], function ($v, $k){
if (!empty($v)) {
if (preg_match('~^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?$~', $k)) {
return true;
}
}
return false;
}, ARRAY_FILTER_USE_BOTH)),
];
}
$xr['routing']['rules'] = $rules ?: [];