up eqot opentomcat

This commit is contained in:
sirpdboy 2021-05-15 00:23:52 +08:00
parent af11f3467f
commit 7b8e2aca8f
19 changed files with 6 additions and 1115 deletions

View File

@ -1,48 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=https-dns-proxy
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:=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 ../../devel/ninja/ninja-cmake.mk
CMAKE_OPTIONS += -DCLANG_TIDY_EXE=
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 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
/etc/config/https-dns-proxy
endef
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
$(eval $(call BuildPackage,https-dns-proxy))

View File

@ -1,94 +0,0 @@
# DNS Over HTTPS Proxy (https-dns-proxy)
A lean RFC8484-compatible (no JSON API support) DNS-over-HTTPS (DoH) proxy service which supports DoH servers ran by AdGuard, CleanBrowsing, Cloudflare, Google, ODVR (nic.cz) and Quad9. Based on [@aarond10](https://github.com/aarond10)'s [https-dns-proxy](https://github.com/aarond10/https_dns_proxy).
## Features
- [RFC8484](https://tools.ietf.org/html/rfc8484)-compatible DoH Proxy.
- Compact size.
- Web UI (```luci-app-https-dns-proxy```) available.
- (By default) automatically updates DNSMASQ settings to use DoH proxy when it's started and reverts to old DNSMASQ resolvers when DoH proxy is stopped.
## Screenshots (luci-app-https-dns-proxy)
![screenshot](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages@master/screenshots/https-dns-proxy/screenshot01.png "https-dns-proxy screenshot")
## Requirements
This proxy requires the following packages to be installed on your router: ```libc```, ```libcares```, ```libcurl```, ```libev```, ```ca-bundle```. They will be automatically installed when you're installing ```https-dns-proxy```.
## Unmet Dependencies
If you are running a development (trunk/snapshot) build of OpenWrt/LEDE Project on your router and your build is outdated (meaning that packages of the same revision/commit hash are no longer available and when you try to satisfy the [requirements](#requirements) you get errors), please flash either current LEDE release image or current development/snapshot image.
## How To Install
Install ```https-dns-proxy``` and ```luci-app-https-dns-proxy``` packages from Web UI or run the following in the command line:
```sh
opkg update; opkg install https-dns-proxy luci-app-https-dns-proxy;
```
## Default Settings
Default configuration has service enabled and starts the service with Google and Cloudflare DoH servers. In most configurations, you will keep the default ```DNSMASQ``` service installed to handle requests from devices in your local network and point ```DNSMASQ``` to use ```https-dns-proxy``` for name resolution.
By default, the service will intelligently override existing ```DNSMASQ``` servers settings on start to use the DoH servers and restores original ```DNSMASQ``` servers on stop. See the [Configuration Settings](#configuration-settings) section below for more information and how to disable this behavior.
## Configuration Settings
Configuration contains the (named) "main" config section where you can configure which ```DNSMASQ``` settings the service will automatically affect and the typed (unnamed) https-dns-proxy instance settings. The original config file is included below:
```text
config main 'config'
option update_dnsmasq_config '*'
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'
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'
```
The ```update_dnsmasq_config``` option can be set to dash (set to ```'-'``` to not change ```DNSMASQ``` server settings on start/stop), can be set to ```'*'``` to affect all ```DNSMASQ``` instance server settings or have a space-separated list of ```DNSMASQ``` instances to affect (like ```'0 4 5'```). If this option is omitted, the default setting is ```'*'```.
Starting with ```https-dns-proxy``` version ```2019-12-03-3``` and higher, when the service is set to update the DNSMASQ servers setting on start/stop, it does not override entries which contain either ```#``` or ```/```, so the entries like listed below will be kept in use:
```test
list server '/onion/127.0.0.1#65453'
list server '/openwrt.org/8.8.8.8'
list server '/pool.ntp.org/8.8.8.8'
list server '127.0.0.1#15353'
list server '127.0.0.1#55353'
list server '127.0.0.1#65353'
```
The https-dns-proxy instance settings are:
|Parameter|Type|Default|Description|
| --- | --- | --- | --- |
|bootstrap_dns|IP Address||The non-encrypted DNS servers to be used to resolve the DoH server name on start.|
|listen_addr|IP Address|127.0.0.1|The local IP address to listen to requests.|
|listen_port|port|5053 and up|If this setting is omitted, the service will start the first https-dns-proxy instance on port 5053, second on 5054 and so on.|
|logfile|Full filepath||Full filepath to the file to log the instance events to.|
|resolver_url|URL||The https URL to the RFC8484-compatible resolver.|
|proxy_server|URL||Local proxy server to use when accessing resolvers.|
|user|String|nobody|Local user to run instance under.|
|group|String|nogroup|Local group to run instance under.|
|use_http1|Boolean|0|If set to 1, use HTTP/1 on installations with broken/outdated ```curl``` package. Included for posterity reasons, you will most likely not ever need it on OpenWrt.|
|verbosity|Integer|0|logging verbosity level. fatal = 0, error = 1, warning = 2, info = 3, debug = 4|
|use_ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
## Thanks
This OpenWrt package wouldn't have been possible without [@aarond10](https://github.com/aarond10)'s [https-dns-proxy](https://github.com/aarond10/https_dns_proxy) and his active participation in the OpenWrt package itself. Special thanks to [@jow-](https://github.com/jow-) for general package/luci guidance.

View File

@ -1,29 +0,0 @@
config main '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'

View File

@ -1,232 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright 2019-2020 Stan Grishin (stangri@melmac.net)
# shellcheck disable=SC2039
PKG_VERSION='dev-test'
# shellcheck disable=SC2034
START=80
# shellcheck disable=SC2034
USE_PROCD=1
if type extra_command 1>/dev/null 2>&1; then
extra_command 'version' 'Show version information'
else
# shellcheck disable=SC2034
EXTRA_COMMANDS='version'
fi
readonly PROG=/usr/sbin/https-dns-proxy
dnsmasqConfig=''; forceDNS=''; forceDNSPorts='';
version() { echo "$PKG_VERSION"; }
xappend() { param="$param $1"; }
append_bool() {
local section="$1"
local option="$2"
local value="$3"
local default="$4"
local _loctmp
[ -z "$default" ] && default="0"
config_get_bool _loctmp "$section" "$option" "$default"
[ "$_loctmp" != "0" ] && xappend "$value"
}
append_parm() {
local section="$1"
local option="$2"
local switch="$3"
local default="$4"
local _loctmp
config_get _loctmp "$section" "$option" "$default"
[ -z "$_loctmp" ] && return 0
xappend "$switch $_loctmp"
}
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" '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'
# shellcheck disable=SC2086,SC2154
for i in $(seq 1 $verbosity); do
xappend '-v'
done
# shellcheck disable=SC2154
if [ "$ipv6_resolvers_only" = 0 ]; then
xappend '-4'
fi
procd_open_instance
# shellcheck disable=SC2086
procd_set_param command ${PROG} ${param}
procd_set_param stderr 1
procd_set_param stdout 1
procd_set_param respawn
procd_close_instance
config_get listen_addr "$cfg" 'listen_addr' '127.0.0.1'
config_get listen_port "$cfg" 'listen_port' "$p"
if [ "$dnsmasqConfig" = "*" ]; then
config_load 'dhcp'
config_foreach dnsmasq_add_doh_server 'dnsmasq' "${listen_addr}" "${listen_port}"
elif [ -n "$dnsmasqConfig" ]; then
for i in $dnsmasqConfig; do
dnsmasq_add_doh_server "@dnsmasq[${i}]" "${listen_addr}" "${listen_port}"
done
fi
p="$((p+1))"
}
is_force_dns_active() { iptables-save | grep -q -w -- '--dport 53'; }
start_service() {
local p=5053 c
config_load 'https-dns-proxy'
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
fi
}
stop_service() {
config_load 'https-dns-proxy'
config_get dnsmasqConfig 'config' 'update_dnsmasq_config' '*'
dhcp_backup 'restore'
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
fi
}
service_triggers() {
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
0.0.0.0|::ffff:0.0.0.0) address='127.0.0.1';;
::) address='::1';;
esac
uci -q del_list "dhcp.${cfg}.server=${address}#${port}"
uci -q add_list "dhcp.${cfg}.server=${address}#${port}"
}
dnsmasq_create_server_backup() {
local cfg="$1"
local i
uci -q get "dhcp.${cfg}" >/dev/null || return 0
if ! uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
if [ -z "$(uci -q get "dhcp.${cfg}.noresolv")" ]; then
uci -q set "dhcp.${cfg}.noresolv=1"
uci -q set "dhcp.${cfg}.doh_backup_noresolv=-1"
elif [ "$(uci -q get "dhcp.${cfg}.noresolv")" != "1" ]; then
uci -q set "dhcp.${cfg}.noresolv=1"
uci -q set "dhcp.${cfg}.doh_backup_noresolv=0"
fi
fi
if ! uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
for i in $(uci -q get "dhcp.${cfg}.server"); do
uci -q add_list "dhcp.${cfg}.doh_backup_server=$i"
if [ "$i" = "${i//127.0.0.1}" ] && [ "$i" = "$(echo "$i" | tr -d /)" ]; then
uci -q del_list "dhcp.${cfg}.server=$i"
fi
done
fi
}
dnsmasq_restore_server_backup() {
local cfg="$1"
local i
uci -q get "dhcp.${cfg}" >/dev/null || return 0
if uci -q get "dhcp.${cfg}.doh_backup_noresolv" >/dev/null; then
if [ "$(uci -q get "dhcp.${cfg}.doh_backup_noresolv")" = "0" ]; then
uci -q set "dhcp.${cfg}.noresolv=0"
else
uci -q del "dhcp.${cfg}.noresolv"
fi
uci -q del "dhcp.${cfg}.doh_backup_noresolv"
fi
if uci -q get "dhcp.${cfg}.doh_backup_server" >/dev/null; then
uci -q del "dhcp.${cfg}.server"
for i in $(uci -q get "dhcp.${cfg}.doh_backup_server"); do
uci -q add_list "dhcp.${cfg}.server=$i"
done
uci -q del "dhcp.${cfg}.doh_backup_server"
fi
}
dhcp_backup() {
local i
config_load 'dhcp'
case "$1" in
create)
if [ "$dnsmasqConfig" = "*" ]; then
config_foreach dnsmasq_create_server_backup 'dnsmasq'
elif [ -n "$dnsmasqConfig" ]; then
for i in $dnsmasqConfig; do
dnsmasq_create_server_backup "@dnsmasq[${i}]"
done
fi
;;
restore)
config_foreach dnsmasq_restore_server_backup 'dnsmasq'
;;
esac
}

View File

@ -1,33 +0,0 @@
--- 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__)

View File

@ -1,3 +0,0 @@
#!/bin/sh
/etc/init.d/"$1" version 2>&1 | grep "$2"

View File

@ -6,5 +6,5 @@ function index()
end
entry({"admin", "control"}, firstchild(), "Control", 44).dependent = false
entry({"admin", "control", "eqos"}, cbi("eqos"), "络限", 90).dependent = true
entry({"admin", "control", "eqos"}, cbi("eqos"), "限制", 90).dependent = true
end

View File

@ -1,51 +0,0 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-turboacc
PKG_VERSION:=1.0
PKG_RELEASE:=2
PKG_LICENSE:=GPLv3.0+
LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE
LUCI_DEPENDS:=+pdnsd-alt \
+PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe:kmod-fast-classifier \
+PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload:kmod-ipt-offload \
+PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca:kmod-tcp-bbr \
+PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder:dnsforwarder
LUCI_PKGARCH:=all
define Package/$(PKG_NAME)/config
config PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe
bool "Include Shortcut-FE"
depends on PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload=n
default y if LINUX_4_9
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload
bool "Include Flow Offload"
depends on !LINUX_4_9
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca
bool "Include BBR CCA"
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder
bool "Include DNSForwarder"
default n
endef
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,39 +0,0 @@
module("luci.controller.turboacc", package.seeall)
function index()
if not nixio.fs.access("/etc/config/turboacc") then
return
end
local page
page = entry({"admin", "network", "turboacc"}, cbi("turboacc"), _("Turbo ACC Center"), 101)
page.i18n = "turboacc"
page.dependent = true
entry({"admin", "network", "turboacc", "status"}, call("action_status"))
end
local function fastpath_status()
return luci.sys.call("{ [ -e /sys/module/xt_FLOWOFFLOAD/refcnt ] && [ x$(cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null) != x0 ]; } || lsmod | grep -q fast_classifier") == 0
end
local function bbr_status()
return luci.sys.call("[ x$(cat /proc/sys/net/ipv4/tcp_congestion_control 2>/dev/null) = xbbr ]") == 0
end
local function fullconebat_status()
return luci.sys.call("[ -e /sys/module/xt_FULLCONENAT/refcnt ] && [ x$(cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null) != x0 ]") == 0
end
local function dnscaching_status()
return luci.sys.call("pgrep dnscache >/dev/null") == 0
end
function action_status()
luci.http.prepare_content("application/json")
luci.http.write_json({
fastpath_state = fastpath_status(),
bbr_state = bbr_status(),
fullconenat_state = fullconebat_status(),
dnscaching_state = dnscaching_status()
})
end

View File

@ -1,87 +0,0 @@
local kernel_version = luci.sys.exec("echo -n $(uname -r)")
m = Map("turboacc")
m.title = translate("Turbo ACC Acceleration Settings")
m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardware NAT)")
m:append(Template("turboacc/status"))
s = m:section(TypedSection, "turboacc", "")
s.addremove = false
s.anonymous = true
if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.ko") then
sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading"))
sw_flow.default = 0
sw_flow.description = translate("Software based offloading for routing/NAT")
sw_flow:depends("sfe_flow", 0)
end
if luci.sys.call("cat /proc/cpuinfo | grep -q MT76") == 0 then
hw_flow = s:option(Flag, "hw_flow", translate("Hardware flow offloading"))
hw_flow.default = 0
hw_flow.description = translate("Requires hardware NAT support. Implemented at least for mt76xx")
hw_flow:depends("sw_flow", 1)
end
if nixio.fs.access("/lib/modules/" .. kernel_version .. "/fast-classifier.ko") then
sfe_flow = s:option(Flag, "sfe_flow", translate("Shortcut-FE flow offloading"))
sfe_flow.default = 0
sfe_flow.description = translate("Shortcut-FE based offloading for routing/NAT")
sfe_flow:depends("sw_flow", 0)
end
sfe_bridge = s:option(Flag, "sfe_bridge", translate("Bridge Acceleration"))
sfe_bridge.default = 0
sfe_bridge.description = translate("Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)")
sfe_bridge:depends("sfe_flow", 1)
if nixio.fs.access("/proc/sys/net/ipv6") then
sfe_ipv6 = s:option(Flag, "sfe_ipv6", translate("IPv6 Acceleration"))
sfe_ipv6.default = 0
sfe_ipv6.description = translate("Enable IPv6 Acceleration")
sfe_ipv6:depends("sfe_flow", 1)
end
if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then
bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA"))
bbr_cca.default = 0
bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively")
end
if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FULLCONENAT.ko") then
fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT"))
fullcone_nat.default = 0
fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively")
end
dns_acc = s:option(Flag, "dns_acc", translate("DNS Acceleration"))
dns_acc.default = 0
dns_acc.rmempty = false
dns_acc.description = translate("Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)")
dns_caching = s:option(Flag, "dns_caching", translate("DNS Caching"))
dns_caching.default = 0
dns_caching.rmempty = false
dns_caching.description = translate("Enable DNS Caching and anti ISP DNS pollution")
dns_caching_mode = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("Only PDNSD and DNSForwarder is supported now"))
dns_caching_mode:value("1", translate("Using PDNSD to query and cache"))
if nixio.fs.access("/usr/bin/dnsforwarder") then
dns_caching_mode:value("2", translate("Using DNSForwarder to query and cache"))
end
dns_caching_mode.default = 1
dns_caching_mode:depends("dns_caching", 1)
dns_caching_v4_dns = s:option(Value, "dns_caching_v4_dns", translate("Upsteam IPv4 DNS Server"))
dns_caching_v4_dns.default = "114.114.114.114,223.5.5.5,223.6.6.6"
dns_caching_v4_dns.description = translate("Muitiple IPv4 DNS server can saperate with ','")
dns_caching_v4_dns:depends("dns_caching_mode", 1)
dns_caching_v4_dns:depends("dns_caching_mode", 2)
dns_caching_v6_dns = s:option(Value, "dns_caching_v6_dns", translate("Upsteam IPv6 DNS Server"))
dns_caching_v6_dns.default = "2400:da00::6666,2400:3200:baba::1,240C::6644"
dns_caching_v6_dns.description = translate("Muitiple IPv6 DNS server can saperate with ','")
dns_caching_v6_dns:depends("dns_caching_mode", 2)
return m

View File

@ -1,25 +0,0 @@
<fieldset class="cbi-section">
<legend><%:Running Status%></legend>
<table width="100%" cellspacing="10" id="_turboacc_status_table">
<tr><td width="33%"><%:Flow Offloading%></td><td id="_fastpath_state"><em><%:Collecting data...%></em></td></tr>
<tr><td width="33%"><%:BBR CCA%></td><td id="_bbr_state"><em><%:Collecting data...%></em></td></tr>
<tr><td width="33%"><%:FullCone NAT%></td><td id="_fullconenat_state"><em><%:Collecting data...%></em></td></tr>
<tr><td width="33%"><%:DNS Caching%></td><td id="_dnscaching_state"><em><%:Collecting data...%></em></td></tr>
</table>
</fieldset>
<script type="text/javascript">//<![CDATA[
var fastpath_state = document.getElementById('_fastpath_state');
var bbr_state = document.getElementById('_bbr_state');
var fullconenat_state = document.getElementById('_fullconenat_state');
var dnscaching_state = document.getElementById('_dnscaching_state');
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "turboacc", "status")%>', null, function(x, status) {
if ( x && x.status == 200 ) {
fastpath_state.innerHTML = status.fastpath_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
bbr_state.innerHTML = status.bbr_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
fullconenat_state.innerHTML = status.fullconenat_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
dnscaching_state.innerHTML = status.dnscaching_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
}
});
//]]>
//]]></script>

View File

@ -1,107 +0,0 @@
msgid "Turbo ACC Center"
msgstr "ACC网络加速"
msgid "Turbo ACC Acceleration Settings"
msgstr "Turbo ACC 网络加速设置"
msgid "Linux Flow Offload Forwarding Engine Settings"
msgstr "Linux Flow Offload Forwarding 转发加速引擎设置"
msgid "Opensource Flow Offloading driver (Fast Path or Hardware NAT)"
msgstr "开源流量分载驱动 (支持 Fast Path 或者 硬件 NAT)"
msgid "Software flow offloading"
msgstr "软件流量分载"
msgid "Software based offloading for routing/NAT"
msgstr "基于软件的 Routing/NAT 分载"
msgid "Hardware flow offloading"
msgstr "硬件流量分载"
msgid "Requires hardware NAT support. Implemented at least for mt76xx"
msgstr "需要硬件 NAT 支持。目前 mt76xx 已实现"
msgid "Shortcut-FE flow offloading"
msgstr "Shortcut-FE 流量分载"
msgid "Shortcut-FE based offloading for routing/NAT"
msgstr "基于 Shortcut-FE 的 Routing/NAT 分载"
msgid "Bridge Acceleration"
msgstr "桥接加速"
msgid "Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)"
msgstr "启用桥接加速 (可能会和路由器上桥接模式的VPN服务器冲突)"
msgid "IPv6 Acceleration"
msgstr "IPv6 加速"
msgid "Enable IPv6 Acceleration"
msgstr "启用 IPv6 加速"
msgid "BBR CCA"
msgstr "BBR 拥塞控制算法"
msgid "Using BBR CCA can improve TCP network performance effectively"
msgstr "使用 BBR 拥塞控制算法可以有效提升 TCP 网络性能"
msgid "FullCone NAT"
msgstr "全锥形 NAT"
msgid "Using FullCone NAT can improve gaming performance effectively"
msgstr "使用全锥形 NAT 可以有效提升游戏体验"
msgid "DNS Acceleration"
msgstr "DNS 加速"
msgid "Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)"
msgstr "使用来自 GoogleHosts 的优质 DNS 记录(请勿在 Clash Fake-IP 模式下使用)"
msgid "DNS Caching"
msgstr "DNS 缓存"
msgid "Enable DNS Caching and anti ISP DNS pollution"
msgstr "启用 DNS 多线程查询、缓存,并防止 ISP 的 DNS 广告和域名劫持"
msgid "Resolve DNS Mode"
msgstr "DNS 解析方式"
msgid "Only PDNSD and DNSForwarder is supported now"
msgstr "目前仅支持 PDNSD 和 DNSForwarder"
msgid "Using PDNSD to query and cache"
msgstr "使用 PDNSD 解析"
msgid "Using DNSForwarder to query and cache"
msgstr "使用 DNSForwarder 解析"
msgid "Upsteam IPv4 DNS Server"
msgstr "上游 IPv4 DNS 服务器"
msgid "Muitiple IPv4 DNS server can saperate with ','"
msgstr "多个上游 IPv4 DNS 服务器请用 ',' 分隔(注意用英文逗号)"
msgid "Upsteam IPv6 DNS Server"
msgstr "上游 IPv6 DNS 服务器"
msgid "Muitiple IPv6 DNS server can saperate with ','"
msgstr "多个上游 IPv6 DNS 服务器请用 ',' 分隔(注意用英文逗号)"
msgid "Running Status"
msgstr "运行状态"
msgid "Flow Offloading"
msgstr "流量分载"
msgid "BBR CCA"
msgstr "BBR 拥塞控制算法"
msgid "FullCone NAT"
msgstr "全锥型 NAT"
msgid "DNS Caching"
msgstr "DNS 缓存"
msgid "Open Web Interface"
msgstr "打开 Web 界面"

View File

@ -1,14 +0,0 @@
config turboacc 'config'
option sw_flow '0'
option hw_flow '0'
option sfe_flow '0'
option sfe_bridge '0'
option sfe_ipv6 '0'
option bbr_cca '1'
option fullcone_nat '1'
option dns_acc '0'
option dns_caching '0'
option dns_caching_mode '1'
option dns_caching_v4_dns '114.114.114.114,223.5.5.5,180.76.76.76,119.29.29.29'
option dns_caching_v6_dns '2400:da00::6666,2400:3200:baba::1,240C::6644'

View File

@ -1,295 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (c) 2011-2015 OpenWrt.org
START=90
STOP=10
restart_utils="true"
inital_conf(){
config_load "turboacc"
config_get "sw_flow" "config" "sw_flow" "0"
config_get "hw_flow" "config" "hw_flow" "0"
config_get "sfe_flow" "config" "sfe_flow" "0"
config_get "sfe_bridge" "config" "sfe_bridge" "0"
config_get "sfe_ipv6" "config" "sfe_ipv6" "0"
config_get "bbr_cca" "config" "bbr_cca" "0"
config_get "fullcone_nat" "config" "fullcone_nat" "0"
config_get "dns_acc" "config" "dns_acc" "0"
config_get "dns_caching" "config" "dns_caching" "0"
config_get "dns_caching_mode" "config" "dns_caching_mode" "0"
config_get "dns_caching_v4_dns" "config" "dns_caching_v4_dns"
config_get "dns_caching_v6_dns" "config" "dns_caching_v6_dns"
[ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.ko" ] && { sw_flow="0"; hw_flow="0"; }
[ ! -e "/lib/modules/$(uname -r)/fast-classifier.ko" ] && { sfe_flow="0"; sfe_bridge="0"; sfe_ipv6="0"; }
[ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0"
[ ! -e "/lib/modules/$(uname -r)/xt_FULLCONENAT.ko" ] && fullcone_nat="0"
}
start_pdnsd() {
[ -d "/var/etc" ] || mkdir -p "/var/etc"
cat > "/var/etc/dnscache.conf" <<EOF
global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid;
server_ip = 127.0.0.1; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
status_ctl = on;
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
query_method=udp_only;
neg_domain_pol = off;
par_queries = 400; # 最多同时请求数
min_ttl = 1h; # DNS结果最短缓存时间
max_ttl = 1w; # DNS结果最长缓存时间
timeout = 10; # DNS请求超时时间单位秒
}
server {
label = "routine";
ip = ${dns_caching_v4_dns}; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
74.125.155.102,
74.125.39.102,
74.125.39.113,
209.85.229.138,
128.121.126.139,
159.106.121.75,
169.132.13.103,
192.67.198.6,
202.106.1.2,
202.181.7.85,
203.161.230.171,
203.98.7.65,
207.12.88.98,
208.56.31.43,
209.145.54.50,
209.220.30.174,
209.36.73.33,
211.94.66.147,
213.169.251.35,
216.221.188.182,
216.234.179.13,
243.185.187.39,
37.61.54.158,
4.36.66.178,
46.82.174.68,
59.24.3.173,
64.33.88.161,
64.33.99.47,
64.66.163.251,
65.104.202.252,
65.160.219.113,
66.45.252.237,
69.55.52.253,
72.14.205.104,
72.14.205.99,
78.16.49.15,
8.7.198.45,
93.46.8.89,
37.61.54.158,
243.185.187.39,
190.93.247.4,
190.93.246.4,
190.93.245.4,
190.93.244.4,
65.49.2.178,
189.163.17.5,
23.89.5.60,
49.2.123.56,
54.76.135.1,
77.4.7.92,
118.5.49.6,
159.24.3.173,
188.5.4.96,
197.4.4.12,
220.250.64.24,
243.185.187.30,
249.129.46.48,
253.157.14.165;
reject_policy = fail;
}
server {
label = "special"; # 这个随便写
ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on;
timeout = 5;
}
source {
owner=localhost;
// serve_aliases=on;
file="/etc/hosts";
}
rr {
name=localhost;
reverse=on;
a=127.0.0.1;
owner=localhost;
soa=localhost,root.localhost,42,86400,900,86400,86400;
}
EOF
if [ ! -f "/var/dnscache/pdnsd.cache" ]; then
mkdir -p "/var/dnscache"
echo -ne "pd13\000\000\000\000" > "/var/dnscache/pdnsd.cache"
chown -R nobody.nogroup "/var/dnscache"
fi
[ -d "/var/sbin" ] || mkdir -p "/var/sbin" && cp -a "/usr/sbin/pdnsd" "/var/sbin/dnscache"
/var/sbin/dnscache -c "/var/etc/dnscache.conf" &
echo "PDNSD: Start DNS Caching"
}
start_dnsforwarder() {
mkdir -p "/var/run/dnscache"
cat > "/var/run/dnscache/dnscache.conf" <<EOF
LogOn false
LogFileThresholdLength 102400
LogFileFolder /var/run/dnscache
UDPLocal 127.0.0.1:5333
UDPGroup ${dns_caching_v4_dns},${dns_caching_v6_dns} * on
GroupFile
BlockIP 243.185.187.39,46.82.174.68,37.61.54.158,93.46.8.89,59.24.3.173,203.98.7.65,8.7.198.45,78.16.49.15,159.106.121.75,69.63.187.12,31.13.76.8,31.13.64.49
IPSubstituting
BlockNegativeResponse false
Hosts
HostsUpdateInterval 18000
HostsDownloadPath
HostsScript
HostsRetryInterval 30
AppendHosts
BlockIpv6WhenIpv4Exists false
UseCache true
CacheSize 1048576
MemoryCache true
CacheFile
IgnoreTTL false
OverrideTTL -1
MultipleTTL 1
ReloadCache false
OverwriteCache false
DisabledType
DisabledDomain
DisabledList
DomainStatistic false
DomainStatisticTempletFile
StatisticUpdateInterval 29
EOF
[ -d "/var/sbin" ] || mkdir -p "/var/sbin" && cp -a "/usr/bin/dnsforwarder" "/var/sbin/dnscache"
/var/sbin/dnscache -f "/var/run/dnscache/dnscache.conf" &
echo "DnsForwarder: Start DNS Caching"
}
stop_dnscache() {
killall -9 "dnscache" 2>"/dev/null"
kill -9 $(ps | grep dnscache-while.sh | grep -v "grep" | awk '{print $1}') 2>"/dev/null"
rm -rf "/var/dnscache" "/var/run/dnscache"
echo "Stop DNS Caching"
}
change_dns() {
uci -q delete dhcp.@dnsmasq[0].server
uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#5333"
uci set dhcp.@dnsmasq[0].noresolv="1"
uci commit dhcp
}
revert_dns() {
uci -q del_list dhcp.@dnsmasq[0].server="127.0.0.1#5333"
uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
uci set dhcp.@dnsmasq[0].noresolv="0"
uci commit dhcp
}
start(){
inital_conf
uci set firewall.@defaults[0].flow_offloading="${sw_flow}"
uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}"
uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
uci commit firewall
[ "${sw_flow}" -ne "1" ] && [ "${sfe_flow}" -eq "1" ] && {
lsmod | grep -q fast_classifier || modprobe fast_classifier 2>"/dev/null"
echo "${sfe_bridge}" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
if [ "${sfe_ipv6}" -eq "1" ]; then
[ ! -e "/dev/sfe_ipv6" ] && mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0"
else
rm -f "/dev/sfe_ipv6"
fi
}
if [ "${bbr_cca}" -eq "1" ]; then
sysctl -w net.ipv4.tcp_congestion_control="bbr"
else
sysctl -w net.ipv4.tcp_congestion_control="cubic"
fi
[ "${dns_acc}" -eq "1" ] && {
mkdir -p "/tmp/dnsmasq.d"
wget-ssl -q -t "20" -T "5" "https://cdn.jsdelivr.net/gh/googlehosts/hosts@master/hosts-files/dnsmasq.conf" -O "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf" &
}
if [ "${dns_caching}" -eq "1" ]; then
stop_dnscache
sleep 1
rm -f "/var/log/dnscache.file"
if [ "${dns_caching_mode}" = "1" ]; then
start_pdnsd
elif [ "${dns_caching_mode}" = "2" ]; then
start_dnsforwarder
fi
change_dns
nohup "/usr/share/dnscache/dnscache-while.sh" > "/var/log/dnscache.file" 2>&1 &
else
stop_dnscache
revert_dns
fi
if [ "${restart_utils}" = "true" ]; then
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ change"
/etc/init.d/firewall restart >/dev/null 2>&1
fi
}
stop(){
inital_conf
uci set firewall.@defaults[0].flow_offloading="${sw_flow}"
uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}"
uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
uci commit firewall
[ "${sfe_flow}" -ne "1" ] && {
echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
rm -f "/dev/sfe_ipv6"
rmmod "fast_classifier" 2>"/dev/null"
}
[ "${dns_acc}" -eq "0" ] && rm -f "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf"
stop_dnscache
revert_dns
if [ "${restart_utils}" = "true" ]; then
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ revert"
/etc/init.d/firewall restart >/dev/null 2>&1
fi
}
restart(){
restart_utils="false"
stop
start
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ restart"
/etc/init.d/firewall restart >/dev/null 2>&1
}

View File

@ -1,10 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@turboacc[-1]
add ucitrack turboacc
set ucitrack.@turboacc[-1].init=turboacc
commit ucitrack
EOF
exit 0

View File

@ -1,31 +0,0 @@
#!/bin/sh
sleeptime=60
logfile="/var/log/dnscache.file"
dns_caching="$(uci -q get turboacc.config.dns_caching)"
dns_caching_mode="$(uci -q get turboacc.config.dns_caching_mode 2>/dev/null)"
clean_log(){
logrow="$(grep -c "" "${logfile}")"
if [ "${logrow}" -ge "500" ];then
echo "${curtime} Log条数超限清空处理" > "${logfile}"
fi
}
while [ "${dns_caching}" -eq "1" ];
do
curtime="$(date "+%H:%M:%S")"
echo "${curtime} online!"
pidof dnscache>/dev/null || {
if [ "${dns_caching_mode}" = "1" ]; then
/var/sbin/dnscache -c "/var/etc/dnscache.conf" &
elif [ "${dns_caching_mode}" = "2" ]; then
/var/sbin/dnscache -f "/var/run/dnscache/dnscache.conf" &
fi
echo "${curtime} 重启服务!" >> ${logfile}
}
clean_log
sleep "${sleeptime}"
continue
done

View File

@ -1,11 +0,0 @@
{
"luci-app-turboacc": {
"description": "Grant UCI access for luci-app-turboacc",
"read": {
"uci": [ "turboacc" ]
},
"write": {
"uci": [ "turboacc" ]
}
}
}

View File

@ -1,7 +1,7 @@
#!/bin/sh
uci batch <<-EOF
set luci.themes.opentomcat=/luci-static/opentomcat
commit luci
EOF
fi
set luci.main.mediaurlbase=/luci-static/opentomcat
commit luci
EOF
exit 0

View File

@ -222,7 +222,7 @@
<div class="fill">
<div class="container">
<span class="showSide"></span>
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
<a class="brand" href="#"><img width="180" alt="Openwrt" src="<%=media%>/icons/logo.svg"></a>
<div class="pull-right">
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
<span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%> </span><%:on%></span>