mosdns: bump to v5.1.3

This commit is contained in:
qingtian110 2023-03-25 18:47:08 +08:00
parent 9629d4722c
commit e6a39f127b
2 changed files with 2 additions and 139 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mosdns
PKG_VERSION:=4.5.3
PKG_VERSION:=5.1.3
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=2a13b1b1d862731cf946a8ceaa99523a0eb0eaae56045dd31207b61a5a6d47ae
PKG_HASH:=7db89b2399ace81e86b53e95e5260e55778ad5e6e8dd82a73dd6989dcd2e0eda
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILE:=LICENSE
@ -33,30 +33,12 @@ define Package/mosdns
TITLE:=A plug-in DNS forwarder/splitter
URL:=https://github.com/IrineSistiana/mosdns
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
PROVIDES:=mosdns-neo
endef
GO_PKG_TARGET_VARS:=$(filter-out CGO_ENABLED=%,$(GO_PKG_TARGET_VARS)) CGO_ENABLED=0
define Package/mosdns/install
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/openwrt/mosdns-init-openwrt $(1)/etc/init.d/mosdns
$(INSTALL_DIR) $(1)/etc/mosdns
$(INSTALL_DATA) ./files/config.yaml $(1)/etc/mosdns/config.yaml
endef
define Package/mosdns/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/mosdns stop >/dev/null 2>&1
/etc/init.d/mosdns disable >/dev/null 2>&1
fi
exit 0
endef
$(eval $(call GoBinPackage,mosdns))

View File

@ -1,119 +0,0 @@
log:
level: error
file: ''
data_providers:
- tag: geosite
file: /usr/share/v2ray/geosite.dat
auto_reload: true
- tag: geoip
file: /usr/share/v2ray/geoip.dat
auto_reload: true
plugins:
# 缓存
- tag: cache
type: cache
args:
size: 1024
# 转发至本地服务器的插件
- tag: forward_local
type: fast_forward
args:
upstream:
- addr: https://1.12.12.12/dns-query
# 转发至远程服务器的插件
- tag: forward_remote
type: fast_forward
args:
upstream:
- addr: https://8.8.8.8/dns-query
# 匹配本地域名的插件
- 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_ad_domain
type: query_matcher
args:
domain:
- 'provider:geosite:category-ads-all'
# 匹配本地 IP 的插件
- tag: response_has_local_ip
type: response_matcher
args:
ip:
- 'provider:geoip:cn'
# 主要的运行逻辑插件
# sequence 插件中调用的插件 tag 必须在 sequence 前定义,
# 否则 sequence 找不到对应插件。
- tag: main_sequence
type: sequence
args:
exec:
# 缓存
- cache
# 屏蔽广告域名
- if: query_is_ad_domain
exec:
- _new_nxdomain_response
- _return
# 已知的本地域名用本地服务器解析
- if: query_is_local_domain
exec:
- forward_local
- _return
# 已知的非本地域名用远程服务器解析
- if: query_is_non_local_domain
exec:
- forward_remote
- _return
# 剩下的未知域名用 IP 分流。
# 这里借助了 `fallback` 工作机制。分流原理请参考 `fallback`
# 的工作流程。
# primary 从本地服务器获取应答,丢弃非本地 IP 的结果。
- primary:
- forward_local
- if: "(! response_has_local_ip) && [_response_valid_answer]"
exec:
- _drop_response
# secondary 从远程服务器获取应答。
secondary:
- _prefer_ipv4
- forward_remote
# 这里建议设置成 local 服务器正常延时的 2~5 倍。
# 这个延时保证了 local 延时偶尔变高时,其结果不会被 remote 抢答。
# 如果 local 超过这个延时还没响应,可以假设 local 出现了问题。
# 这时用就采用 remote 的应答。单位: 毫秒。
fast_fallback: 200
servers:
- exec: main_sequence
listeners:
- protocol: udp
addr: 127.0.0.1:6052
- protocol: tcp
addr: 127.0.0.1:6052
- protocol: udp
addr: '[::1]:6052'
- protocol: tcp
addr: '[::1]:6052'