试试添加q-filter

This commit is contained in:
gently 2019-11-19 12:03:24 +08:00
parent e00c42b1f2
commit d34df77e01
3 changed files with 33659 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#TIME=20191117060009
#TIME=20191119040122
#URL=https://github.com/gentlyxu/anti-AD
address=/js.xiao7cdn.com/
address=/0024aaaa.com/

View File

@ -40,7 +40,7 @@ $arr_result = array_merge_recursive($arr_result, makeAddr::get_domain_list($host
$arr_result = array_merge_recursive($arr_result, $arr_blacklist);
echo 'Written file size:';
echo makeAddr::write_to_conf($arr_result, './adblock-for-dnsmasq.conf');
echo makeAddr::write_to_conf($arr_result, './adblock-for-dnsmasq.conf', 'q-filter.conf');
@ -164,11 +164,16 @@ class makeAddr{
return $arr_domains;
}
public static function write_to_conf($arr_result, $str_file){
public static function write_to_conf($arr_result, $str_file, $q_file){
$fp = fopen($str_file, 'w');
$fp2 = fopen($q_file, 'w');
$write_len = fwrite($fp, '#TIME=' . date('YmdHis'). "\n");
$write_len += fwrite($fp, '#URL=https://github.com/gentlyxu/anti-AD' . "\n");
fwrite($fp2, '[TCP]' . "\n");
fwrite($fp2, 'USER-AGENT,com.apple.*,DIRECT' . "\n");
fwrite($fp2, 'USER-AGENT,FindMy*,DIRECT' . "\n");
fwrite($fp2, 'USER-AGENT,Maps*,DIRECT' . "\n");
foreach($arr_result as $rk => $rv){
@ -186,6 +191,7 @@ class makeAddr{
continue;
}
$write_len += fwrite($fp, 'address=/' . $rv . '/' . "\n");
fwrite($fp2, 'HOST-SUFFIX,' . $rv . ',REJECT' . "\n");
continue;
}
@ -193,6 +199,7 @@ class makeAddr{
if(in_array('.' . $rk, $rv) || in_array('www.' . $rk, $rv) || in_array($rk, $rv)){
$write_len += fwrite($fp, 'address=/' . $rk . '/' . "\n");
fwrite($fp2, 'HOST-SUFFIX,' . $rk . ',REJECT' . "\n");
continue;
}
@ -216,6 +223,7 @@ class makeAddr{
continue;
}
$write_len += fwrite($fp, 'address=/' . implode('.', $tmp_arr2) . '/' . "\n");
fwrite($fp2, 'HOST-SUFFIX,' . implode('.', $tmp_arr2) . ',REJECT' . "\n");
}
$written_flag = true;
break;
@ -229,10 +237,12 @@ class makeAddr{
$arr_written[] = $rvv;
$write_len += fwrite($fp, 'address=/' . $rvv . '/' . "\n");
fwrite($fp2, 'HOST-SUFFIX,' . $rvv . ',REJECT' . "\n");
}
}
fclose($fp);
fclose($fp2);
return $write_len;
}

33646
q-filter.conf Normal file

File diff suppressed because it is too large Load Diff