ability to add IPs and subnets to warplist
This commit is contained in:
+22
-1
@@ -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 ?: [];
|
||||
|
||||
Reference in New Issue
Block a user