mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-06 03:14:22 +08:00
update 2026-08-30 11:09:43
This commit is contained in:
1 parent
b09780b109
commit
a8ecc43b8a
29 files changed
+1484
-49
No files matched your search
@@ -8,7 +8,7 @@ config mosdns 'config'
|
||||
option geo_update_day_time '2'
|
||||
option geoip_type 'geoip-only-cn-private'
|
||||
option configfile '/var/etc/mosdns.json'
|
||||
option log_level 'info'
|
||||
option log_level 'error'
|
||||
option log_file '/var/log/mosdns.log'
|
||||
option log_size '1'
|
||||
option cache '1'
|
||||
@@ -30,4 +30,9 @@ config mosdns 'config'
|
||||
option lazy_cache_ttl '86400'
|
||||
option dump_file '0'
|
||||
option reject_type65 '1'
|
||||
option stats_collector '1'
|
||||
option stats_capacity '2000'
|
||||
option stats_dump_file '0'
|
||||
option stats_dump_interval '600'
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ get_config() {
|
||||
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 "1"
|
||||
config_get log_level $1 log_level "info"
|
||||
config_get log_level $1 log_level "error"
|
||||
config_get minimal_ttl $1 minimal_ttl 0
|
||||
config_get maximum_ttl $1 maximum_ttl 0
|
||||
config_get redirect $1 redirect 0
|
||||
@@ -57,6 +57,10 @@ get_config() {
|
||||
config_get cloudflare $1 cloudflare 0
|
||||
config_get cloudflare_ip $1 cloudflare_ip ""
|
||||
config_get reject_type65 $1 reject_type65 "0"
|
||||
config_get stats_collector $1 stats_collector 1
|
||||
config_get stats_capacity $1 stats_capacity 2000
|
||||
config_get stats_dump_file $1 stats_dump_file 0
|
||||
config_get stats_dump_interval $1 stats_dump_interval 600
|
||||
}
|
||||
|
||||
generate_config() {
|
||||
@@ -79,6 +83,20 @@ generate_config() {
|
||||
json_close_array
|
||||
# plugins
|
||||
json_add_array "plugins"
|
||||
# plugin: stats_collector
|
||||
[ "$stats_collector" -eq 1 ] && {
|
||||
json_add_object
|
||||
json_add_string "tag" "stats_collector"
|
||||
json_add_string "type" "stats_api"
|
||||
json_add_object "args"
|
||||
json_add_int "capacity" "$stats_capacity"
|
||||
[ "$stats_dump_file" -eq 1 ] && {
|
||||
json_add_string "dump_file" "/etc/mosdns/stats.dump"
|
||||
json_add_int "dump_interval" "$stats_dump_interval"
|
||||
}
|
||||
json_close_object
|
||||
json_close_object
|
||||
}
|
||||
# plugin: geosite_cn
|
||||
json_add_object
|
||||
json_add_string "tag" "geosite_cn"
|
||||
@@ -589,6 +607,11 @@ generate_config() {
|
||||
json_add_string "tag" "main_sequence"
|
||||
json_add_string "type" "sequence"
|
||||
json_add_array "args"
|
||||
[ "$stats_collector" -eq 1 ] && {
|
||||
json_add_object
|
||||
json_add_string "exec" "\$stats_collector"
|
||||
json_close_object
|
||||
}
|
||||
json_add_object
|
||||
json_add_string "exec" "\$hosts"
|
||||
json_close_object
|
||||
|
||||
@@ -9,6 +9,14 @@ api:
|
||||
include: []
|
||||
|
||||
plugins:
|
||||
# 统计收集器
|
||||
- tag: stats_collector
|
||||
type: stats_api
|
||||
args:
|
||||
capacity: 2000 # 查询日志环缓冲区容量 (FIFO 覆盖)
|
||||
dump_file: "/etc/mosdns/stats.dump" # 数据持久化转存文件路径,不设置则不转存
|
||||
dump_interval: 600 # 周期性转储间隔(秒)
|
||||
|
||||
# 国内域名
|
||||
- tag: geosite_cn
|
||||
type: domain_set
|
||||
@@ -120,6 +128,7 @@ plugins:
|
||||
- tag: main_sequence
|
||||
type: sequence
|
||||
args:
|
||||
- exec: $stats_collector # 执行全局统计控制器
|
||||
- exec: $lazy_cache
|
||||
- exec: jump has_resp_sequence
|
||||
- exec: $query_is_local_domain
|
||||
|
||||
Reference in new issue
Block a user