mirror of
https://github.com/kenzok8/openwrt-packages.git
synced 2025-01-09 03:58:26 +08:00
update 2022-06-17 20:21:20
This commit is contained in:
parent
e983e66a26
commit
3e91554179
@ -16,7 +16,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-amlogic
|
||||
PKG_VERSION:=3.1.103
|
||||
PKG_VERSION:=3.1.104
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 License
|
||||
|
@ -368,7 +368,7 @@ EOF
|
||||
fdisk /dev/${EMMC_NAME} </tmp/fdisk.script 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "The fdisk partition fails, Please try again."
|
||||
dd if=/root/BackupOldBootloader.img of=/dev/${EMMC_NAME} conf=fsync && sync
|
||||
dd if=/root/BackupOldBootloader.img of=/dev/${EMMC_NAME} conv=fsync && sync
|
||||
dd if=/dev/zero of=/dev/${EMMC_NAME} bs=512 count=1 && sync
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mosdns
|
||||
PKG_VERSION:=1.3
|
||||
PKG_VERSION:=1.4
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI Support for mosdns
|
||||
|
@ -1,6 +1,6 @@
|
||||
local datatypes = require "luci.cbi.datatypes"
|
||||
|
||||
local white_list_file = "/etc/mosdns/whitelist.txt"
|
||||
local white_list_file = "/etc/mosdns/rule/whitelist.txt"
|
||||
local block_list_file = "/etc/mosdns/rule/blocklist.txt"
|
||||
local hosts_list_file = "/etc/mosdns/rule/hosts.txt"
|
||||
local redirect_list_file = "/etc/mosdns/rule/redirect.txt"
|
||||
|
@ -66,15 +66,30 @@ delcron() {
|
||||
}
|
||||
|
||||
adblock() {
|
||||
cp -f /etc/mosdns/serverlist.txt /etc/mosdns/serverlist.bak
|
||||
cp -f /etc/mosdns/rule/serverlist.txt /etc/mosdns/rule/serverlist.bak
|
||||
modns_adblock=$(uci -q get mosdns.mosdns.adblock)
|
||||
if [ "$modns_adblock" = 0 ]; then
|
||||
: > /etc/mosdns/serverlist.txt
|
||||
: > /etc/mosdns/rule/serverlist.txt
|
||||
else
|
||||
cat /etc/mosdns/serverlist.bak >/etc/mosdns/serverlist.txt
|
||||
cat /etc/mosdns/rule/serverlist.bak >/etc/mosdns/rule/serverlist.txt
|
||||
fi
|
||||
}
|
||||
|
||||
v4config() {
|
||||
chmod -R 755 /etc/mosdns/*.sh
|
||||
sed -i 's/\r//g' /etc/mosdns/dns.sh /etc/mosdns/library.sh
|
||||
sed -i 's/\r$//' /etc/mosdns/dns.sh /etc/mosdns/library.sh
|
||||
rm -rf /etc/mosdns/def_config.yaml
|
||||
cp -rf /etc/mosdns/def_config_orig.yaml /etc/mosdns/def_config.yaml
|
||||
sed -i "s,listenport,$(uci -q get mosdns.mosdns.listen_port),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,loglvl,$(uci -q get mosdns.mosdns.loglv),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,logfile,$(uci -q get mosdns.mosdns.logfile),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,remotedns1,$(uci -q get mosdns.mosdns.remote_dns1),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,remotedns2,$(uci -q get mosdns.mosdns.remote_dns2),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,localdns1,$(bash /etc/mosdns/dns.sh 0),g" /etc/mosdns/def_config.yaml
|
||||
sed -i "s,localdns2,$(bash /etc/mosdns/dns.sh 1),g" /etc/mosdns/def_config.yaml
|
||||
}
|
||||
|
||||
start_service() {
|
||||
|
||||
# Reading config
|
||||
@ -93,8 +108,9 @@ start_service() {
|
||||
adblock
|
||||
cat /dev/null > $(uci -q get mosdns.mosdns.logfile)
|
||||
sysctl -w net.core.rmem_max=2500000
|
||||
v4config
|
||||
procd_open_instance mosdns
|
||||
procd_set_param command $PROG -dir $RES_DIR -c "$CONF"
|
||||
procd_set_param command $PROG start -d $RES_DIR -c "$CONF"
|
||||
procd_set_param user root
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
@ -1,96 +1,31 @@
|
||||
# 日志设置
|
||||
log:
|
||||
level: error
|
||||
file: ""
|
||||
level: info # 日志级别。可选 "debug" "info" "warn" "error"。默认 "info"。
|
||||
file: "/path/to/log/file" # 记录日志到文件。
|
||||
|
||||
plugin:
|
||||
- tag: main_server
|
||||
type: server
|
||||
args:
|
||||
entry:
|
||||
- _no_ecs
|
||||
- lazy_cache
|
||||
- _prefer_ipv4
|
||||
- _single_flight
|
||||
- main_sequence
|
||||
server:
|
||||
- protocol: udp
|
||||
addr: "127.0.0.1:5335"
|
||||
- protocol: tcp
|
||||
addr: "127.0.0.1:5335"
|
||||
# 数据源设置
|
||||
data_providers:
|
||||
- tag: data1 # 数据源的 tag。由用户自由设定。不能重复。
|
||||
file: "/path/to/data/file" # 文件位置
|
||||
auto_reload: true # 文件有变化时是否自动重载。
|
||||
|
||||
- tag: main_sequence
|
||||
type: sequence
|
||||
args:
|
||||
exec:
|
||||
- if:
|
||||
- query_is_ad_domain
|
||||
exec:
|
||||
- _block_with_nxdomain
|
||||
- _return
|
||||
- if:
|
||||
- query_is_local_domain
|
||||
- "!_query_is_common"
|
||||
exec:
|
||||
- forward_local
|
||||
- _return
|
||||
- if:
|
||||
- query_is_non_local_domain
|
||||
exec:
|
||||
- forward_remote
|
||||
- _return
|
||||
- primary:
|
||||
- forward_local
|
||||
- if:
|
||||
- "!response_has_local_ip"
|
||||
exec:
|
||||
- _drop_response
|
||||
secondary:
|
||||
- forward_remote
|
||||
fast_fallback: 150
|
||||
always_standby: true
|
||||
# 插件设置
|
||||
plugins:
|
||||
- tag: tag1 # 插件的 tag。由用户自由设定。不能重复。
|
||||
type: type1 # 插件类型。详见下文。
|
||||
args: # 插件参数。取决于插件类型。详见下文。
|
||||
key1: value1
|
||||
key2: value2
|
||||
|
||||
- tag: forward_local
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: ${{ ./dns.sh 0 }}
|
||||
- addr: ${{ ./dns.sh 1 }}
|
||||
|
||||
- tag: forward_remote
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: "tls://8.8.4.4"
|
||||
idle_timeout: 10
|
||||
- addr: "tls://9.9.9.9"
|
||||
idle_timeout: 10
|
||||
|
||||
- tag: lazy_cache
|
||||
type: cache
|
||||
args:
|
||||
size: 512000
|
||||
lazy_cache_ttl: 259200
|
||||
|
||||
- tag: query_is_local_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:/usr/share/v2ray/geosite.dat:cn"
|
||||
|
||||
- tag: query_is_non_local_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:/usr/share/v2ray/geosite.dat:geolocation-!cn"
|
||||
|
||||
- tag: response_has_local_ip
|
||||
type: response_matcher
|
||||
args:
|
||||
ip:
|
||||
- "ext:/usr/share/v2ray/geoip.dat:cn"
|
||||
|
||||
- tag: query_is_ad_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:./serverlist.txt"
|
||||
# 服务器设置
|
||||
servers:
|
||||
- exec: tag1 # 本服务器运行插件的 tag。
|
||||
timeout: 5 # 请求处理超时时间。单位: 秒。默认: 5。
|
||||
listener: # 监听设置
|
||||
- protocol: https # 协议,支持 "udp", "tcp", "tls", "https" 和 "http"
|
||||
addr: ":443" # 监听地址。
|
||||
cert: "/path/to/my/cert" # TLS 所需证书文件。
|
||||
key: "/path/to/my/key" # TLS 所需密钥文件。
|
||||
url_path: "/dns-query" # DoH 路径。
|
||||
get_user_ip_from_header: "X-Forwarded-For" # DoH 尝试从 HTTP 头获取用户 IP。
|
||||
idle_timeout: 10 # 连接复用空连接超时时间。单位: 秒。默认: 10。
|
@ -1,142 +0,0 @@
|
||||
log:
|
||||
level: ${{ uci -q get mosdns.mosdns.loglv }}
|
||||
file: ${{ uci -q get mosdns.mosdns.logfile }}
|
||||
|
||||
plugin:
|
||||
- tag: forward_local
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: ${{ ./dns.sh 0 }}
|
||||
- addr: ${{ ./dns.sh 1 }}
|
||||
|
||||
- tag: query_is_whitelist_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:./whitelist.txt"
|
||||
|
||||
- tag: query_is_blocklist_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:/etc/mosdns/rule/blocklist.txt"
|
||||
|
||||
- tag: query_is_hosts_domain
|
||||
type: hosts
|
||||
args:
|
||||
hosts:
|
||||
- "ext:/etc/mosdns/rule/hosts.txt"
|
||||
|
||||
- tag: query_is_redirect_domain
|
||||
type: redirect
|
||||
args:
|
||||
rule:
|
||||
- "ext:/etc/mosdns/rule/redirect.txt"
|
||||
|
||||
- tag: forward_remote
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: ${{ uci -q get mosdns.mosdns.remote_dns1 }}
|
||||
- addr: ${{ uci -q get mosdns.mosdns.remote_dns2 }}
|
||||
|
||||
- tag: lazy_cache
|
||||
type: cache
|
||||
args:
|
||||
size: 512000
|
||||
lazy_cache_ttl: 259200
|
||||
|
||||
- tag: query_is_local_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:/usr/share/v2ray/geosite.dat:cn"
|
||||
- "ext:/usr/share/v2ray/geosite.dat:apple-cn"
|
||||
|
||||
- tag: query_is_non_local_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:/usr/share/v2ray/geosite.dat:geolocation-!cn"
|
||||
|
||||
- tag: response_has_local_ip
|
||||
type: response_matcher
|
||||
args:
|
||||
ip:
|
||||
- "ext:/usr/share/v2ray/geoip.dat:cn"
|
||||
|
||||
- tag: query_is_ad_domain
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "ext:./serverlist.txt"
|
||||
|
||||
- tag: qtype65
|
||||
type: query_matcher
|
||||
args:
|
||||
qtype: [65]
|
||||
|
||||
- tag: query_is_local_ptr
|
||||
type: query_matcher
|
||||
args:
|
||||
logical_and: true
|
||||
qtype: [12]
|
||||
domain:
|
||||
- "ext:./local-ptr.txt"
|
||||
|
||||
- tag: main_sequence
|
||||
type: sequence
|
||||
args:
|
||||
exec:
|
||||
- query_is_hosts_domain
|
||||
- query_is_redirect_domain
|
||||
- if:
|
||||
- query_is_whitelist_domain
|
||||
exec:
|
||||
- forward_local
|
||||
- _return
|
||||
- if:
|
||||
- query_is_blocklist_domain
|
||||
- query_is_ad_domain
|
||||
- qtype65
|
||||
- query_is_local_ptr
|
||||
exec:
|
||||
- _block_with_nxdomain
|
||||
- _return
|
||||
- if:
|
||||
- query_is_local_domain
|
||||
- "!_query_is_common"
|
||||
exec:
|
||||
- forward_local
|
||||
- _return
|
||||
- if:
|
||||
- query_is_non_local_domain
|
||||
exec:
|
||||
- forward_remote
|
||||
- _return
|
||||
- primary:
|
||||
- forward_local
|
||||
- if:
|
||||
- "!response_has_local_ip"
|
||||
exec:
|
||||
- _drop_response
|
||||
secondary:
|
||||
- forward_remote
|
||||
fast_fallback: 150
|
||||
always_standby: true
|
||||
|
||||
- tag: main_server
|
||||
type: server
|
||||
args:
|
||||
entry:
|
||||
- _no_ecs
|
||||
- lazy_cache
|
||||
- _prefer_ipv4
|
||||
- _single_flight
|
||||
- main_sequence
|
||||
server:
|
||||
- protocol: udp
|
||||
addr: ":${{ uci -q get mosdns.mosdns.listen_port }}"
|
||||
- protocol: tcp
|
||||
addr: ":${{ uci -q get mosdns.mosdns.listen_port }}"
|
167
luci-app-mosdns/root/etc/mosdns/def_config_orig.yaml
Normal file
167
luci-app-mosdns/root/etc/mosdns/def_config_orig.yaml
Normal file
@ -0,0 +1,167 @@
|
||||
# 日志设置
|
||||
log:
|
||||
level: loglvl
|
||||
file: logfile
|
||||
|
||||
# 数据源设置
|
||||
data_providers:
|
||||
- tag: geosite
|
||||
file: "/usr/share/v2ray/geosite.dat"
|
||||
auto_reload: true
|
||||
|
||||
- tag: geoip
|
||||
file: "/usr/share/v2ray/geoip.dat"
|
||||
auto_reload: true
|
||||
|
||||
- tag: adlist
|
||||
file: "./rule/serverlist.txt"
|
||||
auto_reload: true
|
||||
|
||||
- tag: whitelist
|
||||
file: "./rule/whitelist.txt"
|
||||
auto_reload: true
|
||||
|
||||
- tag: hosts
|
||||
file: "./rule/hosts.txt"
|
||||
auto_reload: true
|
||||
|
||||
- tag: blocklist
|
||||
file: "./rule/blocklist.txt"
|
||||
auto_reload: true
|
||||
|
||||
- tag: local_ptr
|
||||
file: "./rule/local-ptr.txt"
|
||||
auto_reload: true
|
||||
|
||||
- tag: redirect
|
||||
file: "./rule/redirect.txt"
|
||||
auto_reload: true
|
||||
|
||||
# 插件
|
||||
plugins:
|
||||
- tag: "query_is_whitelist_domain"
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "provider:whitelist"
|
||||
|
||||
- tag: "query_is_blocklist_domain"
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "provider:blocklist"
|
||||
|
||||
- tag: "query_is_local_domain"
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "provider:geosite:cn"
|
||||
|
||||
- tag: "query_is_non_local_domain"
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "provider:geosite:geolocation-!cn"
|
||||
|
||||
- tag: "query_is_qtype65"
|
||||
type: query_matcher
|
||||
args:
|
||||
qtype: [65]
|
||||
|
||||
- tag: "query_is_local_ptr"
|
||||
type: query_matcher
|
||||
args:
|
||||
qtype: [12]
|
||||
domain:
|
||||
- "provider:local_ptr"
|
||||
|
||||
- tag: "query_is_ad_domain"
|
||||
type: query_matcher
|
||||
args:
|
||||
domain:
|
||||
- "provider:adlist"
|
||||
|
||||
- tag: "response_has_local_ip"
|
||||
type: response_matcher
|
||||
args:
|
||||
ip:
|
||||
- "provider:geoip:cn"
|
||||
|
||||
- tag: "query_is_hosts_domain"
|
||||
type: hosts
|
||||
args:
|
||||
hosts:
|
||||
- "provider:hosts"
|
||||
|
||||
- tag: "query_is_redirect_domain"
|
||||
type: redirect
|
||||
args:
|
||||
rule:
|
||||
- "provider:redirect"
|
||||
|
||||
- tag: "lazy_cache"
|
||||
type: cache
|
||||
args:
|
||||
size: 512000
|
||||
lazy_cache_ttl: 259200
|
||||
|
||||
- tag: "forward_local"
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: localdns1
|
||||
- addr: localdns2
|
||||
|
||||
- tag: "forward_remote"
|
||||
type: fast_forward
|
||||
args:
|
||||
upstream:
|
||||
- addr: remotedns1
|
||||
- addr: remotedns2
|
||||
|
||||
- tag: main_sequence
|
||||
type: sequence
|
||||
args:
|
||||
exec:
|
||||
- _misc_optm
|
||||
- _single_flight
|
||||
- lazy_cache
|
||||
- query_is_hosts_domain
|
||||
- query_is_redirect_domain
|
||||
- _no_ecs
|
||||
- if: "query_is_whitelist_domain"
|
||||
exec:
|
||||
- forward_local
|
||||
- _return
|
||||
- if: "query_is_blocklist_domain || query_is_ad_domain || query_is_qtype65 || query_is_local_ptr"
|
||||
exec:
|
||||
- _new_nxdomain_response
|
||||
- _return
|
||||
- if: "query_is_local_domain"
|
||||
exec:
|
||||
- forward_local
|
||||
- _return
|
||||
- if: "query_is_non_local_domain"
|
||||
exec:
|
||||
- _prefer_ipv4
|
||||
- forward_remote
|
||||
- _return
|
||||
- primary:
|
||||
- forward_local
|
||||
- if: "(! response_has_local_ip) && [_response_valid_answer]"
|
||||
exec:
|
||||
- _drop_response
|
||||
secondary:
|
||||
- _prefer_ipv4
|
||||
- forward_remote
|
||||
fast_fallback: 150
|
||||
always_standby: true
|
||||
|
||||
# 服务器设置
|
||||
servers:
|
||||
- exec: main_sequence
|
||||
listeners:
|
||||
- protocol: udp
|
||||
addr: :listenport
|
||||
- protocol: tcp
|
||||
addr: :listenport
|
@ -21,14 +21,14 @@ rm -rf "$TMPDIR"
|
||||
|
||||
syncconfig=$(uci -q get mosdns.mosdns.syncconfig)
|
||||
if [ "$syncconfig" -eq 1 ]; then
|
||||
#wget https://cdn.jsdelivr.net/gh/QiuSimons/openwrt-mos@master/luci-app-mosdns/root/etc/mosdns/def_config.yaml -nv -O /tmp/mosdns/def_config.yaml
|
||||
#wget https://cdn.jsdelivr.net/gh/QiuSimons/openwrt-mos@master/luci-app-mosdns/root/etc/mosdns/def_config_v4.yaml -nv -O /tmp/mosdns/def_config_orig.yaml
|
||||
TMPDIR=$(mktemp -d) || exit 2
|
||||
getdat def_config_new.yaml
|
||||
getdat def_config_v4.yaml
|
||||
|
||||
if [ "$(grep -o plugin "$TMPDIR"/def_config_new.yaml | wc -l)" -eq "0" ]; then
|
||||
rm -rf "$TMPDIR"/def_config_new.yaml
|
||||
rm -rf "$TMPDIR"/def_config_v4.yaml
|
||||
else
|
||||
mv "$TMPDIR"/def_config_new.yaml "$TMPDIR"/def_config.yaml
|
||||
mv "$TMPDIR"/def_config_v4.yaml "$TMPDIR"/def_config_orig.yaml
|
||||
fi
|
||||
cp -rf "$TMPDIR"/* /etc/mosdns
|
||||
rm -rf "$TMPDIR"
|
||||
@ -42,8 +42,8 @@ if [ "$adblock" -eq 1 ]; then
|
||||
if [ "$(grep -o .com "$TMPDIR"/serverlist.txt | wc -l)" -lt "1000" ]; then
|
||||
rm -rf "$TMPDIR"/serverlist.txt
|
||||
fi
|
||||
cp -rf "$TMPDIR"/* /etc/mosdns
|
||||
rm -rf /etc/mosdns/serverlist.bak "$TMPDIR"
|
||||
cp -rf "$TMPDIR"/* /etc/mosdns/rule
|
||||
rm -rf /etc/mosdns/rule/serverlist.bak "$TMPDIR"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosdns
|
||||
PKG_VERSION:=385aec0
|
||||
PKG_VERSION:=dc1fe3a
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
|
Loading…
Reference in New Issue
Block a user