mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 20:02:51 +08:00
🦄 Sync 2026-05-02 20:20:38
This commit is contained in:
1 parent
7cd03aa918
commit
d5efb00b6d
12 files changed
+129
-70
No files matched your search
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mosdns
|
||||
PKG_VERSION:=1.7.2
|
||||
PKG_RELEASE:=6
|
||||
PKG_RELEASE:=7
|
||||
|
||||
LUCI_TITLE:=LuCI Support for mosdns
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -66,7 +66,7 @@ generate_config() {
|
||||
json_close_object
|
||||
# api
|
||||
json_add_object 'api'
|
||||
json_add_string "http" "0.0.0.0:$listen_port_api"
|
||||
json_add_string "http" "127.0.0.1:$listen_port_api"
|
||||
json_close_object
|
||||
# include
|
||||
json_add_array "include"
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.4.15
|
||||
PKG_RELEASE:=106
|
||||
PKG_RELEASE:=107
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -945,6 +945,28 @@ function parseURL(url_str)
|
||||
return res
|
||||
end
|
||||
|
||||
function parseDoH(doh_str)
|
||||
doh_str = trim(doh_str)
|
||||
if doh_str == "" then return nil end
|
||||
|
||||
local url_part, ip_part
|
||||
if doh_str:find(",", 1, true) then
|
||||
url_part, ip_part = doh_str:match("^([^,]+),(.+)$")
|
||||
else
|
||||
url_part = doh_str
|
||||
end
|
||||
|
||||
local res = parseURL(url_part)
|
||||
if not res then return nil end
|
||||
|
||||
res.url = url_part
|
||||
if ip_part and ip_part ~= "" and is_ip(ip_part) then
|
||||
res.hostip = ip_part
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
local default_file_tree = {
|
||||
x86_64 = "amd64",
|
||||
x86 = "386",
|
||||
|
||||
@@ -166,7 +166,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
local server_port
|
||||
local server_path
|
||||
if dns_proto == "https" then
|
||||
local _a = api.parseURL(node.domain_resolver_dns_https)
|
||||
local _a = api.parseDoH(node.domain_resolver_dns_https)
|
||||
if _a then
|
||||
server_address = _a.hostname
|
||||
server_port = _a.port or 443
|
||||
@@ -1024,10 +1024,7 @@ function gen_config(var)
|
||||
local remote_dns_udp_port = var["remote_dns_udp_port"]
|
||||
local remote_dns_tcp_server = var["remote_dns_tcp_server"]
|
||||
local remote_dns_tcp_port = var["remote_dns_tcp_port"]
|
||||
local remote_dns_doh_url = var["remote_dns_doh_url"]
|
||||
local remote_dns_doh_host = var["remote_dns_doh_host"]
|
||||
local remote_dns_doh_ip = var["remote_dns_doh_ip"]
|
||||
local remote_dns_doh_port = var["remote_dns_doh_port"]
|
||||
local remote_dns_doh = var["remote_dns_doh"]
|
||||
local remote_dns_http3 = var["remote_dns_http3"]
|
||||
local remote_dns_client_ip = var["remote_dns_client_ip"]
|
||||
local remote_dns_query_strategy = var["remote_dns_query_strategy"]
|
||||
@@ -1762,13 +1759,15 @@ function gen_config(var)
|
||||
remote_server.type = "udp"
|
||||
remote_server.server = remote_dns_udp_server
|
||||
remote_server.server_port = server_port
|
||||
|
||||
elseif remote_dns_tcp_server then
|
||||
local server_port = tonumber(remote_dns_tcp_port) or 53
|
||||
remote_server.type = "tcp"
|
||||
remote_server.server = remote_dns_tcp_server
|
||||
remote_server.server_port = server_port
|
||||
elseif remote_dns_doh_url then
|
||||
local _a = api.parseURL(remote_dns_doh_url)
|
||||
|
||||
elseif remote_dns_doh then
|
||||
local _a = api.parseDoH(remote_dns_doh)
|
||||
if _a then
|
||||
remote_server.type = "https"
|
||||
if remote_dns_http3 then
|
||||
@@ -1777,15 +1776,16 @@ function gen_config(var)
|
||||
remote_server.server = _a.hostname
|
||||
remote_server.server_port = _a.port or 443
|
||||
remote_server.path = _a.pathname or ""
|
||||
end
|
||||
if api.datatypes.hostname(remote_dns_doh_host) then
|
||||
if remote_dns_doh_ip and remote_dns_doh_host ~= remote_dns_doh_ip and api.is_ip(remote_dns_doh_ip) then
|
||||
if not hosts_predefined then hosts_predefined = {} end
|
||||
hosts_predefined[remote_dns_doh_host] = remote_dns_doh_ip
|
||||
remote_server_domain_resolver = "hosts"
|
||||
else
|
||||
GLOBAL.DNS_HOSTNAME[remote_dns_doh_host] = true
|
||||
remote_server_domain_resolver = "direct"
|
||||
|
||||
if api.datatypes.hostname(_a.hostname) then
|
||||
if _a.hostip then
|
||||
if not hosts_predefined then hosts_predefined = {} end
|
||||
hosts_predefined[_a.hostname] = _a.hostip
|
||||
remote_server_domain_resolver = "hosts"
|
||||
else
|
||||
GLOBAL.DNS_HOSTNAME[_a.hostname] = true
|
||||
remote_server_domain_resolver = "direct"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -408,9 +408,9 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
local config_address
|
||||
local config_port
|
||||
if dns_proto == "https" then
|
||||
local _a = api.parseURL(node.domain_resolver_dns_https)
|
||||
local _a = api.parseDoH(node.domain_resolver_dns_https)
|
||||
if _a then
|
||||
config_address = node.domain_resolver_dns_https
|
||||
config_address = _a.url
|
||||
config_port = _a.port or 443
|
||||
if _a.hostname and api.datatypes.hostname(_a.hostname) then
|
||||
GLOBAL.DNS_HOSTNAME[_a.hostname] = true
|
||||
@@ -801,10 +801,7 @@ function gen_config(var)
|
||||
local remote_dns_udp_port = var["remote_dns_udp_port"]
|
||||
local remote_dns_tcp_server = var["remote_dns_tcp_server"]
|
||||
local remote_dns_tcp_port = var["remote_dns_tcp_port"]
|
||||
local remote_dns_doh_url = var["remote_dns_doh_url"]
|
||||
local remote_dns_doh_host = var["remote_dns_doh_host"]
|
||||
local remote_dns_doh_ip = var["remote_dns_doh_ip"]
|
||||
local remote_dns_doh_port = var["remote_dns_doh_port"]
|
||||
local remote_dns_doh = var["remote_dns_doh"]
|
||||
local remote_dns_client_ip = var["remote_dns_client_ip"]
|
||||
local remote_dns_fake = var["remote_dns_fake"]
|
||||
local remote_dns_query_strategy = var["remote_dns_query_strategy"]
|
||||
@@ -1497,7 +1494,7 @@ function gen_config(var)
|
||||
})
|
||||
end
|
||||
|
||||
if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) or remote_dns_doh_url or #node_dns > 0 then
|
||||
if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) or remote_dns_doh or #node_dns > 0 then
|
||||
if not routing then
|
||||
routing = {
|
||||
domainStrategy = "IPOnDemand",
|
||||
@@ -1560,22 +1557,24 @@ function gen_config(var)
|
||||
if remote_dns_udp_server then
|
||||
_remote_dns.address = remote_dns_udp_server
|
||||
_remote_dns.port = tonumber(remote_dns_udp_port) or 53
|
||||
|
||||
elseif remote_dns_tcp_server then
|
||||
_remote_dns.address = "tcp://" .. remote_dns_tcp_server .. ":" .. tonumber(remote_dns_tcp_port) or 53
|
||||
end
|
||||
|
||||
local _remote_dns_host
|
||||
if remote_dns_doh_url and remote_dns_doh_host then
|
||||
if api.datatypes.hostname(remote_dns_doh_host) then
|
||||
if remote_dns_doh_ip and remote_dns_doh_host ~= remote_dns_doh_ip and api.is_ip(remote_dns_doh_ip) then
|
||||
dns.hosts[remote_dns_doh_host] = remote_dns_doh_ip
|
||||
_remote_dns_host = remote_dns_doh_host
|
||||
else
|
||||
GLOBAL.DNS_HOSTNAME[remote_dns_doh_host] = true
|
||||
elseif remote_dns_doh then
|
||||
local _a = api.parseDoH(remote_dns_doh)
|
||||
if _a then
|
||||
_remote_dns.address = _a.url
|
||||
_remote_dns.port = _a.port or 443
|
||||
|
||||
if api.datatypes.hostname(_a.hostname) then
|
||||
if _a.hostip then
|
||||
dns.hosts[_a.hostname] = _a.hostip
|
||||
else
|
||||
GLOBAL.DNS_HOSTNAME[_a.hostname] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
_remote_dns.address = remote_dns_doh_url
|
||||
_remote_dns.port = tonumber(remote_dns_doh_port)
|
||||
end
|
||||
|
||||
if next(_remote_dns) then
|
||||
|
||||
@@ -172,12 +172,7 @@ run_singbox() {
|
||||
json_add_string "remote_dns_${_proto}_port" "${_dns_port}"
|
||||
;;
|
||||
doh|http3)
|
||||
local _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
[ -n "$_doh_bootstrap" ] && json_add_string "remote_dns_doh_ip" "${_doh_bootstrap}"
|
||||
json_add_string "remote_dns_doh_port" "${_doh_port}"
|
||||
json_add_string "remote_dns_doh_url" "${_doh_url}"
|
||||
json_add_string "remote_dns_doh_host" "${_doh_host}"
|
||||
json_add_string "remote_dns_doh" "${remote_dns_doh}"
|
||||
[ "$remote_dns_protocol" = "http3" ] && json_add_string "remote_dns_http3" "1"
|
||||
;;
|
||||
esac
|
||||
@@ -269,12 +264,7 @@ run_xray() {
|
||||
json_add_string "remote_dns_${_proto}_port" "${_dns_port}"
|
||||
;;
|
||||
doh)
|
||||
local _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
[ -n "$_doh_bootstrap" ] && json_add_string "remote_dns_doh_ip" "${_doh_bootstrap}"
|
||||
json_add_string "remote_dns_doh_port" "${_doh_port}"
|
||||
json_add_string "remote_dns_doh_url" "${_doh_url}"
|
||||
json_add_string "remote_dns_doh_host" "${_doh_host}"
|
||||
json_add_string "remote_dns_doh" "${remote_dns_doh}"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -1351,10 +1341,6 @@ start_dns() {
|
||||
local remote_dns_doh=$(config_t_get global remote_dns_doh "https://1.1.1.1/dns-query")
|
||||
_args="${_args} remote_dns_doh=${remote_dns_doh}"
|
||||
echolog " - Sing-Box DNS(${TUN_DNS}) -> ${remote_dns_doh}"
|
||||
|
||||
local _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
[ -n "${_doh_bootstrap}" ] && REMOTE_DNS="${_doh_bootstrap}#${_doh_port}"
|
||||
;;
|
||||
esac
|
||||
_args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}"
|
||||
@@ -1390,10 +1376,6 @@ start_dns() {
|
||||
local remote_dns_doh=$(config_t_get global remote_dns_doh "https://1.1.1.1/dns-query")
|
||||
_args="${_args} remote_dns_doh=${remote_dns_doh}"
|
||||
echolog " - Xray DNS(${TUN_DNS}) -> ${remote_dns_doh}"
|
||||
|
||||
local _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap
|
||||
[ -n "${_doh_bootstrap}" ] && REMOTE_DNS="${REMOTE_DNS},${_doh_bootstrap}#${_doh_port}"
|
||||
;;
|
||||
esac
|
||||
_args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}"
|
||||
|
||||
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-webdav
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
LUCI_TITLE:=LuCI support for WebDav
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
{
|
||||
"admin/nas": {
|
||||
"title": "NAS",
|
||||
"order": 44,
|
||||
"action": {
|
||||
"type": "firstchild"
|
||||
}
|
||||
},
|
||||
"admin/nas/webdav": {
|
||||
"admin/services/webdav": {
|
||||
"title": "WebDAV",
|
||||
"order": 90,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "webdav"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosdns
|
||||
PKG_VERSION:=5.3.4
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=9
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v$(PKG_VERSION)?
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 8f9c6ca1ac8e9b5e10a5c45f3f338546424c95f1 Mon Sep 17 00:00:00 2001
|
||||
From: sbwml <admin@cooluc.com>
|
||||
Date: Sat, 2 May 2026 13:43:31 +0800
|
||||
Subject: [PATCH] feat(adblock_set): support hosts file format blocking rules
|
||||
|
||||
Parse lines like "0.0.0.0 domain" and "127.0.0.1 domain" as exact-match
|
||||
blocking rules, compatible with AdGuard Home hosts-style lists.
|
||||
|
||||
Signed-off-by: sbwml <admin@cooluc.com>
|
||||
---
|
||||
plugin/data_provider/adblock_set/adblock_set_test.go | 6 ++++++
|
||||
plugin/data_provider/adblock_set/parser.go | 12 ++++++++++++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
--- a/plugin/data_provider/adblock_set/adblock_set_test.go
|
||||
+++ b/plugin/data_provider/adblock_set/adblock_set_test.go
|
||||
@@ -42,6 +42,8 @@ func TestParseAndMatch(t *testing.T) {
|
||||
blocked.com
|
||||
domain:ntp.org
|
||||
full:metrics.icloud.com
|
||||
+0.0.0.0 singlehotmilf.online
|
||||
+127.0.0.1 deezer.deliveryengine.adswizz.com
|
||||
`
|
||||
blacklist := domain.NewMixMatcher[struct{}]()
|
||||
whitelist := domain.NewMixMatcher[struct{}]()
|
||||
@@ -75,6 +77,10 @@ full:metrics.icloud.com
|
||||
{"sub.ntp.org", true}, // matched by domain:ntp.org
|
||||
{"metrics.icloud.com", true}, // matched by full:metrics.icloud.com
|
||||
{"sub.metrics.icloud.com", false}, // full match only
|
||||
+ {"singlehotmilf.online", true}, // hosts: 0.0.0.0
|
||||
+ {"sub.singlehotmilf.online", false}, // hosts: exact match only
|
||||
+ {"deezer.deliveryengine.adswizz.com", true}, // hosts: 127.0.0.1
|
||||
+ {"sub.deezer.deliveryengine.adswizz.com", false}, // hosts: exact match only
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
--- a/plugin/data_provider/adblock_set/parser.go
|
||||
+++ b/plugin/data_provider/adblock_set/parser.go
|
||||
@@ -22,6 +22,7 @@ package adblock_set
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
+ "net"
|
||||
"strings"
|
||||
|
||||
"github.com/IrineSistiana/mosdns/v5/pkg/matcher/domain"
|
||||
@@ -36,6 +37,17 @@ func ParseRules(r io.Reader, blacklist,
|
||||
continue
|
||||
}
|
||||
|
||||
+ // Handle hosts file format: "0.0.0.0 domain" or "127.0.0.1 domain"
|
||||
+ if fields := strings.Fields(line); len(fields) >= 2 {
|
||||
+ if ip := net.ParseIP(fields[0]); ip != nil {
|
||||
+ host := fields[1]
|
||||
+ if host != "" && host != "localhost" {
|
||||
+ _ = blacklist.Add("full:"+host, struct{}{})
|
||||
+ }
|
||||
+ continue
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Handle whitelists
|
||||
isWhitelist := false
|
||||
if strings.HasPrefix(line, "@@") {
|
||||
@@ -9,7 +9,7 @@ PKG_NAME:=natmapt
|
||||
PKG_UPSTREAM_VERSION:=20260214
|
||||
PKG_UPSTREAM_GITHASH:=
|
||||
PKG_VERSION:=$(PKG_UPSTREAM_VERSION)$(if $(PKG_UPSTREAM_GITHASH),~$(call version_abbrev,$(PKG_UPSTREAM_GITHASH)))
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
SCRIPTS_VERSION:=0.2026.01.24
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_UPSTREAM_NAME)-$(PKG_UPSTREAM_VERSION)
|
||||
@@ -23,7 +23,7 @@ PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
|
||||
else
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/heiher/natmap.git
|
||||
PKG_SOURCE_VERSION:=b098467e0b9e8e6cd81f6baf398f11f247bb5afb
|
||||
PKG_SOURCE_VERSION:=079bce1d6c5798fa6f47d364b737762dae89aafc
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
Reference in new issue
Block a user