mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-03 18:53:56 +08:00
update 2026-08-24 20:37:43
This commit is contained in:
1 parent
4e37f23d47
commit
0f2308381e
1964 files changed
+1523405
-239
No files matched your search
@@ -10,6 +10,7 @@ config mosdns 'config'
|
||||
option configfile '/var/etc/mosdns.json'
|
||||
option log_level 'info'
|
||||
option log_file '/var/log/mosdns.log'
|
||||
option log_size '5'
|
||||
option cache '1'
|
||||
option concurrent '2'
|
||||
option idle_timeout '30'
|
||||
|
||||
@@ -33,6 +33,7 @@ get_config() {
|
||||
config_get listen_port $1 listen_port 5335
|
||||
config_get listen_address $1 listen_address "0.0.0.0"
|
||||
config_get log_file $1 log_file "/var/log/mosdns.log"
|
||||
config_get log_size $1 log_size "5"
|
||||
config_get log_level $1 log_level "info"
|
||||
config_get minimal_ttl $1 minimal_ttl 0
|
||||
config_get maximum_ttl $1 maximum_ttl 0
|
||||
@@ -67,6 +68,7 @@ generate_config() {
|
||||
json_add_object 'log'
|
||||
json_add_string "level" "$log_level"
|
||||
json_add_string "file" "$log_file"
|
||||
json_add_string "size" "$log_size"
|
||||
json_close_object
|
||||
# api
|
||||
json_add_object 'api'
|
||||
|
||||
@@ -281,34 +281,34 @@ function v2dat_dump() {
|
||||
exec_sys('rm -f /var/mosdns/geo*.txt');
|
||||
|
||||
if (configfile === "/var/etc/mosdns.json") {
|
||||
exec_sys(`v2dat unpack geoip -o /var/mosdns -f cn ${v2dat_dir}/geoip.dat`);
|
||||
exec_sys(`v2dat unpack geosite -o /var/mosdns -f cn -f apple -f 'geolocation-!cn' ${v2dat_dir}/geosite.dat`);
|
||||
exec_sys(`geo2txt geoip -f ${v2dat_dir}/geoip.dat -e cn -o /var/mosdns`);
|
||||
exec_sys(`geo2txt geosite -f ${v2dat_dir}/geosite.dat -e cn -e apple -e 'geolocation-!cn' -o /var/mosdns`);
|
||||
|
||||
if (adblock === '1' && index(ad_source, 'geosite.dat') !== -1) {
|
||||
exec_sys(`v2dat unpack geosite -o /var/mosdns -f category-ads-all ${v2dat_dir}/geosite.dat`);
|
||||
exec_sys(`geo2txt geosite -f ${v2dat_dir}/geosite.dat -e category-ads-all -o /var/mosdns`);
|
||||
}
|
||||
|
||||
if (streaming_media === '1') {
|
||||
exec_sys(`v2dat unpack geosite -o /var/mosdns -f netflix -f disney -f hulu ${v2dat_dir}/geosite.dat`);
|
||||
exec_sys(`geo2txt geosite -f ${v2dat_dir}/geosite.dat -e netflix -e disney -e hulu -o /var/mosdns`);
|
||||
} else {
|
||||
writefile('/var/mosdns/geosite_disney.txt', '');
|
||||
writefile('/var/mosdns/geosite_netflix.txt', '');
|
||||
writefile('/var/mosdns/geosite_hulu.txt', '');
|
||||
}
|
||||
} else {
|
||||
exec_sys(`v2dat unpack geoip -o /var/mosdns -f cn ${v2dat_dir}/geoip.dat`);
|
||||
exec_sys(`v2dat unpack geosite -o /var/mosdns -f cn -f 'geolocation-!cn' ${v2dat_dir}/geosite.dat`);
|
||||
exec_sys(`geo2txt geoip -f ${v2dat_dir}/geoip.dat -e cn -o /var/mosdns`);
|
||||
exec_sys(`geo2txt geosite -f ${v2dat_dir}/geosite.dat -e cn -e 'geolocation-!cn' -o /var/mosdns`);
|
||||
|
||||
let geoip_tags = to_array(uci_cursor.get('mosdns', 'config', 'geoip_tags'));
|
||||
if (length(geoip_tags) > 0) {
|
||||
let tags_str = "-f '" + join("' -f '", geoip_tags) + "'";
|
||||
exec_sys(`v2dat unpack geoip -o /var/mosdns ${tags_str} ${v2dat_dir}/geoip.dat`);
|
||||
let tags_str = "-e '" + join("' -e '", geoip_tags) + "'";
|
||||
exec_sys(`geo2txt geoip -f ${v2dat_dir}/geoip.dat ${tags_str} -o /var/mosdns`);
|
||||
}
|
||||
|
||||
let geosite_tags = to_array(uci_cursor.get('mosdns', 'config', 'geosite_tags'));
|
||||
if (length(geosite_tags) > 0) {
|
||||
let tags_str = "-f '" + join("' -f '", geosite_tags) + "'";
|
||||
exec_sys(`v2dat unpack geosite -o /var/mosdns ${tags_str} ${v2dat_dir}/geosite.dat`);
|
||||
let tags_str = "-e '" + join("' -e '", geosite_tags) + "'";
|
||||
exec_sys(`geo2txt geosite -f ${v2dat_dir}/geosite.dat ${tags_str} -o /var/mosdns`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user