mirror of
https://github.com/sirpdboy/sirpdboy-package.git
synced 2025-01-08 11:57:57 +08:00
up 2021
This commit is contained in:
parent
739d760b4b
commit
22b05412a4
@ -1,20 +1,20 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=https-dns-proxy
|
||||
PKG_VERSION:=2020-04-09
|
||||
PKG_RELEASE=3
|
||||
PKG_VERSION:=2021-01-17
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy
|
||||
PKG_SOURCE_DATE:=2020-04-09
|
||||
PKG_SOURCE_VERSION:=40647ce94c62a47e9d53efae8018fb3142e277b9
|
||||
PKG_MIRROR_HASH:=4a8052b8bd482a17b769bcd4ee2620368f8c91955c5e976088be8d2ab002dde6
|
||||
PKG_SOURCE_DATE:=2021-01-17
|
||||
PKG_SOURCE_VERSION:=37511cc08712d7548978a4f6f1cc457b7594fb96
|
||||
PKG_MIRROR_HASH:=4e6a7dcb69e350d1df9f17570439b589e031e249da7f91f2ec7600a955e0aaa3
|
||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include ../../devel/ninja/ninja-cmake.mk
|
||||
|
||||
CMAKE_OPTIONS += -DCLANG_TIDY_EXE=
|
||||
|
||||
@ -22,13 +22,15 @@ define Package/https-dns-proxy
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=DNS Over HTTPS Proxy
|
||||
URL:=https://docs.openwrt.melmac.net/https-dns-proxy/
|
||||
DEPENDS:=+libcares +libcurl +libev +ca-bundle
|
||||
CONFLICTS:=https_dns_proxy
|
||||
endef
|
||||
|
||||
define Package/https-dns-proxy/description
|
||||
https_dns_proxy is a light-weight DNS<-->HTTPS, non-caching translation proxy for the RFC 8484 DNS-over-HTTPS standard. It receives regular (UDP) DNS requests and issues them via DoH.
|
||||
Please see https://github.com/openwrt/packages/blob/master/net/https-dns-proxy/files/README.md for further information.
|
||||
https-dns-proxy is a light-weight DNS<-->HTTPS, non-caching translation proxy for the RFC 8484 DoH standard.
|
||||
It receives regular (UDP) DNS requests and issues them via DoH.
|
||||
Please see https://docs.openwrt.melmac.net/https-dns-proxy/ for more information.
|
||||
endef
|
||||
|
||||
define Package/https-dns-proxy/conffiles
|
||||
@ -39,14 +41,8 @@ define Package/https-dns-proxy/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d ${1}/etc/config
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/https_dns_proxy $(1)/usr/sbin/https-dns-proxy
|
||||
$(INSTALL_BIN) ./files/https-dns-proxy.init $(1)/etc/init.d/https-dns-proxy
|
||||
$(SED) "s|^\(PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/https-dns-proxy
|
||||
$(INSTALL_CONF) ./files/https-dns-proxy.config $(1)/etc/config/https-dns-proxy
|
||||
endef
|
||||
|
||||
define Package/https-dns-proxy/postinst
|
||||
#!/bin/sh
|
||||
/etc/init.d/https-dns-proxy disable
|
||||
/etc/init.d/https-dns-proxy stop
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,https-dns-proxy))
|
||||
|
@ -1,2 +1,29 @@
|
||||
config main 'config'
|
||||
option update_dnsmasq_config ''
|
||||
option update_dnsmasq_config '-'
|
||||
option force_dns '0'
|
||||
list force_dns_port '53'
|
||||
list force_dns_port '853'
|
||||
# ports listed below are used by some
|
||||
# of the dnscrypt-proxy v1 resolvers
|
||||
# list force_dns_port '553'
|
||||
# list force_dns_port '1443'
|
||||
# list force_dns_port '4343'
|
||||
# list force_dns_port '4434'
|
||||
# list force_dns_port '5443'
|
||||
# list force_dns_port '8443'
|
||||
|
||||
config https-dns-proxy
|
||||
option bootstrap_dns '1.1.1.1,1.0.0.1'
|
||||
option resolver_url 'https://cloudflare-dns.com/dns-query'
|
||||
option listen_addr '127.0.0.1'
|
||||
option listen_port '5054'
|
||||
option user 'nobody'
|
||||
option group 'nogroup'
|
||||
|
||||
config https-dns-proxy
|
||||
option bootstrap_dns '8.8.8.8,8.8.4.4'
|
||||
option resolver_url 'https://dns.google/dns-query'
|
||||
option listen_addr '127.0.0.1'
|
||||
option listen_port '5053'
|
||||
option user 'nobody'
|
||||
option group 'nogroup'
|
||||
|
@ -1,13 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright 2019 Stan Grishin (stangri@melmac.net)
|
||||
# Copyright 2019-2020 Stan Grishin (stangri@melmac.net)
|
||||
# shellcheck disable=SC2039
|
||||
PKG_VERSION='dev-test'
|
||||
|
||||
export START=80
|
||||
export USE_PROCD=1
|
||||
# shellcheck disable=SC2034
|
||||
START=80
|
||||
# shellcheck disable=SC2034
|
||||
USE_PROCD=1
|
||||
|
||||
dnsmasqConfig=''
|
||||
if type extra_command 1>/dev/null 2>&1; then
|
||||
extra_command 'version' 'Show version information'
|
||||
else
|
||||
# shellcheck disable=SC2034
|
||||
EXTRA_COMMANDS='version'
|
||||
fi
|
||||
|
||||
PROG=/usr/sbin/https-dns-proxy
|
||||
readonly PROG=/usr/sbin/https-dns-proxy
|
||||
dnsmasqConfig=''; forceDNS=''; forceDNSPorts='';
|
||||
|
||||
version() { echo "$PKG_VERSION"; }
|
||||
|
||||
xappend() { param="$param $1"; }
|
||||
|
||||
@ -35,26 +46,27 @@ append_parm() {
|
||||
|
||||
start_instance() {
|
||||
local cfg="$1" param listen_addr listen_port i
|
||||
|
||||
append_parm "$cfg" 'resolver_url' '-r'
|
||||
append_parm "$cfg" 'polling_interval' '-i'
|
||||
append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
|
||||
append_parm "$cfg" 'listen_port' '-p' "$p"
|
||||
append_parm "$cfg" 'dscp_codepoint' '-c'
|
||||
append_parm "$cfg" 'bootstrap_dns' '-b'
|
||||
append_parm "$cfg" 'resolver_url' '-r'
|
||||
append_parm "$cfg" 'user' '-u' 'nobody'
|
||||
append_parm "$cfg" 'group' '-g' 'nogroup'
|
||||
append_parm "$cfg" 'proxy_server' '-t'
|
||||
append_parm "$cfg" 'logfile' '-l'
|
||||
append_bool "$cfg" 'use_http1' '-x'
|
||||
config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
|
||||
config_get verbosity "$cfg" 'verbosity' "0"
|
||||
config_get verbosity "$cfg" 'verbosity' '0'
|
||||
|
||||
# shellcheck disable=SC2086,SC2154
|
||||
for i in $(seq 1 $verbosity); do
|
||||
xappend "-v"
|
||||
xappend '-v'
|
||||
done
|
||||
# shellcheck disable=SC2154
|
||||
if [ "$ipv6_resolvers_only" = 0 ]; then
|
||||
xappend "-4"
|
||||
xappend '-4'
|
||||
fi
|
||||
|
||||
procd_open_instance
|
||||
@ -79,17 +91,50 @@ start_instance() {
|
||||
p="$((p+1))"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'https-dns-proxy'
|
||||
}
|
||||
is_force_dns_active() { iptables-save | grep -q -w -- '--dport 53'; }
|
||||
|
||||
start_service() {
|
||||
local p=5053
|
||||
local p=5053 c
|
||||
config_load 'https-dns-proxy'
|
||||
#config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||
config_get_bool forceDNS 'config' 'force_dns' '1'
|
||||
config_get forceDNSPorts 'config' 'force_dns_port' '53 853'
|
||||
dhcp_backup 'create'
|
||||
config_load 'https-dns-proxy'
|
||||
config_foreach start_instance 'https-dns-proxy'
|
||||
if [ "$forceDNS" -ne 0 ]; then
|
||||
procd_open_instance 'main'
|
||||
procd_set_param command /bin/true
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_open_data
|
||||
json_add_array firewall
|
||||
for c in $forceDNSPorts; do
|
||||
if netstat -tuln | grep 'LISTEN' | grep ":${c}" >/dev/null 2>&1 || [ "$c" = "53" ]; then
|
||||
json_add_object ""
|
||||
json_add_string type redirect
|
||||
json_add_string target DNAT
|
||||
json_add_string src lan
|
||||
json_add_string proto "tcp udp"
|
||||
json_add_string src_dport "$c"
|
||||
json_add_string dest_port "$c"
|
||||
json_add_boolean reflection 0
|
||||
json_close_object
|
||||
else
|
||||
json_add_object ""
|
||||
json_add_string type rule
|
||||
json_add_string src lan
|
||||
json_add_string dest "*"
|
||||
json_add_string proto "tcp udp"
|
||||
json_add_string dest_port "$c"
|
||||
json_add_string target REJECT
|
||||
json_close_object
|
||||
fi
|
||||
done
|
||||
json_close_array
|
||||
procd_close_data
|
||||
procd_close_instance
|
||||
fi
|
||||
if [ -n "$(uci -q changes dhcp)" ]; then
|
||||
uci -q commit dhcp
|
||||
[ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
@ -98,7 +143,7 @@ start_service() {
|
||||
|
||||
stop_service() {
|
||||
config_load 'https-dns-proxy'
|
||||
#config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
|
||||
dhcp_backup 'restore'
|
||||
if [ -n "$(uci -q changes dhcp)" ]; then
|
||||
uci -q commit dhcp
|
||||
@ -107,9 +152,12 @@ stop_service() {
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'https-dns-proxy'
|
||||
procd_add_config_trigger "config.change" "https-dns-proxy" /etc/init.d/https-dns-proxy reload
|
||||
}
|
||||
|
||||
service_started() { procd_set_config_changed firewall; }
|
||||
service_stopped() { procd_set_config_changed firewall; }
|
||||
|
||||
dnsmasq_add_doh_server() {
|
||||
local cfg="$1" address="$2" port="$3"
|
||||
case $address in
|
||||
@ -181,4 +229,4 @@ dhcp_backup() {
|
||||
config_foreach dnsmasq_restore_server_backup 'dnsmasq'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
33
https-dns-proxy/patches/010-ninja.patch
Normal file
33
https-dns-proxy/patches/010-ninja.patch
Normal file
@ -0,0 +1,33 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,7 +5,6 @@ set(CMAKE_BUILD_TYPE "Debug")
|
||||
#set(CMAKE_BUILD_TYPE "Release")
|
||||
|
||||
#set(CMAKE_C_FLAGS "-Wall -Wextra --pedantic -Wno-strict-aliasing")
|
||||
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(notdir $<)\"'")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2")
|
||||
|
||||
--- a/src/logging.h
|
||||
+++ b/src/logging.h
|
||||
@@ -34,6 +34,20 @@ enum _LogSeverity {
|
||||
LOG_FATAL = 4,
|
||||
};
|
||||
|
||||
+#define STRIPPATH(s)\
|
||||
+ (sizeof(s) > 2 && (s)[sizeof(s)-2] == '/' ? (s) + sizeof(s) - 1 : \
|
||||
+ sizeof(s) > 3 && (s)[sizeof(s)-3] == '/' ? (s) + sizeof(s) - 2 : \
|
||||
+ sizeof(s) > 4 && (s)[sizeof(s)-4] == '/' ? (s) + sizeof(s) - 3 : \
|
||||
+ sizeof(s) > 5 && (s)[sizeof(s)-5] == '/' ? (s) + sizeof(s) - 4 : \
|
||||
+ sizeof(s) > 6 && (s)[sizeof(s)-6] == '/' ? (s) + sizeof(s) - 5 : \
|
||||
+ sizeof(s) > 7 && (s)[sizeof(s)-7] == '/' ? (s) + sizeof(s) - 6 : \
|
||||
+ sizeof(s) > 8 && (s)[sizeof(s)-8] == '/' ? (s) + sizeof(s) - 7 : \
|
||||
+ sizeof(s) > 9 && (s)[sizeof(s)-9] == '/' ? (s) + sizeof(s) - 8 : \
|
||||
+ sizeof(s) > 10 && (s)[sizeof(s)-10] == '/' ? (s) + sizeof(s) - 9 : \
|
||||
+ sizeof(s) > 11 && (s)[sizeof(s)-11] == '/' ? (s) + sizeof(s) - 10 : (s))
|
||||
+
|
||||
+#define __FILENAME__ STRIPPATH(__FILE__)
|
||||
+
|
||||
// Debug, Info, Warning, Error logging.
|
||||
#define DLOG(...) _log(__FILENAME__, __LINE__, LOG_DEBUG, __VA_ARGS__)
|
||||
#define ILOG(...) _log(__FILENAME__, __LINE__, LOG_INFO, __VA_ARGS__)
|
3
https-dns-proxy/test.sh
Normal file
3
https-dns-proxy/test.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/"$1" version 2>&1 | grep "$2"
|
Loading…
Reference in New Issue
Block a user