mirror of
https://github.com/roacn/openwrt-packages.git
synced 2025-01-07 03:16:45 +08:00
⛅ Sync 2024-08-15 16:27
This commit is contained in:
parent
ca6b1edbb5
commit
2e031d9d7d
@ -10,7 +10,7 @@ PKG_NAME:=luci-app-cloudflarespeedtest
|
||||
LUCI_TITLE:=LuCI support for Cloudflares Speed Test
|
||||
LUCI_DEPENDS:=+cdnspeedtest +openssl-util +curl
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.5.3
|
||||
PKG_VERSION:=1.5.4
|
||||
PKG_RELEASE:=0
|
||||
PKG_LICENSE:=AGPL-3.0
|
||||
PKG_MAINTAINER:=mingxiaoyu <fengying0347@163.com>
|
||||
|
@ -314,6 +314,11 @@ o=s:taboption("dnshost", Value,"host_domain",translate("Domain"))
|
||||
o.rmempty=true
|
||||
o:depends("HOST_enabled", 1)
|
||||
|
||||
s:tab("mosdns", translate("MosDNS"))
|
||||
o=s:taboption("mosdns", Flag, "MosDNS_enabled",translate("MosDNS Enabled"))
|
||||
o=s:taboption("mosdns", Flag, "openclash_restart",translate("OpenClash Restart"))
|
||||
o:depends("MosDNS_enabled", 1)
|
||||
|
||||
e=m:section(TypedSection,"global",translate("Best IP"))
|
||||
e.anonymous=true
|
||||
local a="/usr/share/cloudflarespeedtestresult.txt"
|
||||
|
@ -219,3 +219,9 @@ msgstr "启用HOST"
|
||||
|
||||
msgid "Domain"
|
||||
msgstr "域名"
|
||||
|
||||
msgid "MosDNS Enabled"
|
||||
msgstr "写入 MosDNS"
|
||||
|
||||
msgid "OpenClash Restart"
|
||||
msgstr "重启 OpenClash"
|
||||
|
@ -219,3 +219,9 @@ msgstr "启用HOST"
|
||||
|
||||
msgid "Domain"
|
||||
msgstr "域名"
|
||||
|
||||
msgid "MosDNS Enabled"
|
||||
msgstr "写入 MosDNS"
|
||||
|
||||
msgid "OpenClash Restart"
|
||||
msgstr "重启 OpenClash"
|
||||
|
@ -27,7 +27,7 @@ echolog() {
|
||||
|
||||
function read_config(){
|
||||
get_global_config "enabled" "speed" "custome_url" "threads" "custome_cors_enabled" "custome_cron" "t" "tp" "dt" "dn" "dd" "tl" "tll" "ipv6_enabled" "advanced" "proxy_mode"
|
||||
get_servers_config "ssr_services" "ssr_enabled" "passwall_enabled" "passwall_services" "passwall2_enabled" "passwall2_services" "bypass_enabled" "bypass_services" "vssr_enabled" "vssr_services" "DNS_enabled" "HOST_enabled"
|
||||
get_servers_config "ssr_services" "ssr_enabled" "passwall_enabled" "passwall_services" "passwall2_enabled" "passwall2_services" "bypass_enabled" "bypass_services" "vssr_enabled" "vssr_services" "DNS_enabled" "HOST_enabled" "MosDNS_enabled" "openclash_restart"
|
||||
}
|
||||
|
||||
function appinit(){
|
||||
@ -130,6 +130,19 @@ function speed_test(){
|
||||
/etc/init.d/bypass restart
|
||||
fi
|
||||
|
||||
if [ "x${MosDNS_enabled}" == "x1" ] ;then
|
||||
if [ -n "$(grep 'option cloudflare' /etc/config/mosdns)" ]
|
||||
then
|
||||
sed -i".bak" "/option cloudflare/d" /etc/config/mosdns
|
||||
fi
|
||||
sed -i '/^$/d' /etc/config/mosdns && echo -e "\toption cloudflare '0'" >> /etc/config/mosdns
|
||||
|
||||
/etc/init.d/mosdns restart &>/dev/null
|
||||
if [ "x${openclash_restart}" == "x1" ] ;then
|
||||
/etc/init.d/openclash restart &>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $command >> $LOG_FILE 2>&1
|
||||
echolog "-----------start----------"
|
||||
$command >> $LOG_FILE 2>&1
|
||||
@ -144,6 +157,7 @@ function ip_replace(){
|
||||
echolog "CloudflareST 测速结果 IP 数量为 0,跳过下面步骤..."
|
||||
else
|
||||
host_ip
|
||||
mosdns_ip
|
||||
alidns_ip
|
||||
ssr_best_ip
|
||||
vssr_best_ip
|
||||
@ -174,6 +188,26 @@ function host_ip() {
|
||||
fi
|
||||
}
|
||||
|
||||
function mosdns_ip() {
|
||||
if [ "x${MosDNS_enabled}" == "x1" ] ;then
|
||||
if [ -n "$(grep 'option cloudflare' /etc/config/mosdns)" ]
|
||||
then
|
||||
sed -i".bak" "/option cloudflare/d" /etc/config/mosdns
|
||||
fi
|
||||
if [ -n "$(grep 'list cloudflare_ip' /etc/config/mosdns)" ]
|
||||
then
|
||||
sed -i".bak" "/list cloudflare_ip/d" /etc/config/mosdns
|
||||
fi
|
||||
sed -i '/^$/d' /etc/config/mosdns && echo -e "\toption cloudflare '1'\n\tlist cloudflare_ip '$bestip'" >> /etc/config/mosdns
|
||||
|
||||
/etc/init.d/mosdns restart &>/dev/null
|
||||
if [ "x${openclash_restart}" == "x1" ] ;then
|
||||
/etc/init.d/openclash restart &>/dev/null
|
||||
fi
|
||||
echolog "MosDNS 写入完成"
|
||||
fi
|
||||
}
|
||||
|
||||
function passwall_best_ip(){
|
||||
if [ "x${passwall_enabled}" == "x1" ] ;then
|
||||
echolog "设置passwall IP"
|
||||
|
@ -37,6 +37,12 @@ function renderStatus(isRunning) {
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
L.resolveDefault(fs.exec('/usr/bin/mosdns', ['version']), null),
|
||||
]);
|
||||
},
|
||||
|
||||
handleFlushCache: function (m, section_id, ev) {
|
||||
return fs.exec('/usr/share/mosdns/mosdns.sh', ['flush'])
|
||||
.then(function (lazy_cache) {
|
||||
@ -49,10 +55,14 @@ return view.extend({
|
||||
});
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var m, s, o;
|
||||
render: function (basic) {
|
||||
var m, s, o, v;
|
||||
v = '';
|
||||
|
||||
m = new form.Map('mosdns', _('MosDNS'),
|
||||
if (basic[0] && basic[0].code === 0) {
|
||||
v = basic[0].stdout.trim();
|
||||
}
|
||||
m = new form.Map('mosdns', _('MosDNS') + ' ' + v,
|
||||
_('MosDNS is a plugin-based DNS forwarder/traffic splitter.'));
|
||||
|
||||
s = m.section(form.TypedSection);
|
||||
|
@ -14,6 +14,7 @@
|
||||
"/etc/mosdns/rule/redirect.txt": [ "read" ],
|
||||
"/etc/mosdns/rule/streaming.txt": [ "read" ],
|
||||
"/etc/mosdns/rule/whitelist.txt": [ "read" ],
|
||||
"/usr/bin/mosdns": [ "exec" ],
|
||||
"/usr/share/mosdns/mosdns.sh": [ "exec" ]
|
||||
},
|
||||
"ubus": {
|
||||
|
@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosdns
|
||||
PKG_VERSION:=5.3.1
|
||||
PKG_VERSION:=5.3.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=7c8c795de794df52fd2b51214826aea9ebde0dcd0da78d8dda9cc5e4ab98cd80
|
||||
PKG_HASH:=1d7eeaa735cb48ed2d436797d7f2a82541699f74647cd293ee411a72cdc65f5f
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
|
@ -1,51 +0,0 @@
|
||||
From 329ba9ca89d25da58d1b51b8107f164beae816bb Mon Sep 17 00:00:00 2001
|
||||
From: sbwml <admin@cooluc.com>
|
||||
Date: Tue, 19 Sep 2023 21:15:12 +0800
|
||||
Subject: [PATCH 1/5] compatible with go1.20
|
||||
|
||||
---
|
||||
go.mod | 6 ++----
|
||||
go.sum | 4 ++--
|
||||
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/go.mod b/go.mod
|
||||
index 1839776..1b4cc4b 100644
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -1,8 +1,6 @@
|
||||
module github.com/IrineSistiana/mosdns/v5
|
||||
|
||||
-go 1.21
|
||||
-
|
||||
-toolchain go1.21.1
|
||||
+go 1.20
|
||||
|
||||
require (
|
||||
github.com/IrineSistiana/go-bytes-pool v0.0.0-20230918115058-c72bd9761c57
|
||||
@@ -45,7 +43,7 @@ require (
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/mdlayher/netlink v1.7.2 // indirect
|
||||
- github.com/mdlayher/socket v0.5.0 // indirect
|
||||
+ github.com/mdlayher/socket v0.4.1 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.13.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
diff --git a/go.sum b/go.sum
|
||||
index 41a59b2..ad95d6d 100644
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -173,8 +173,8 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvls
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
|
||||
github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g=
|
||||
github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw=
|
||||
-github.com/mdlayher/socket v0.5.0 h1:ilICZmJcQz70vrWVes1MFera4jGiWNocSkykwwoy3XI=
|
||||
-github.com/mdlayher/socket v0.5.0/go.mod h1:WkcBFfvyG8QENs5+hfQPl1X6Jpd2yeLIYgrGFmJiJxI=
|
||||
+github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
|
||||
+github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
|
||||
github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE=
|
||||
github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
--
|
||||
2.42.0
|
||||
|
@ -7,11 +7,9 @@ Subject: [PATCH 3/5] add response for bad request in ServeHTTP handler
|
||||
pkg/server/http_handler.go | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/pkg/server/http_handler.go b/pkg/server/http_handler.go
|
||||
index 5a41314..8f33b3f 100644
|
||||
--- a/pkg/server/http_handler.go
|
||||
+++ b/pkg/server/http_handler.go
|
||||
@@ -93,6 +93,7 @@ func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
@@ -93,6 +93,7 @@ func (h *HttpHandler) ServeHTTP(w http.R
|
||||
if err != nil {
|
||||
h.warnErr(req, "invalid request", err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
@ -19,6 +17,3 @@ index 5a41314..8f33b3f 100644
|
||||
return
|
||||
}
|
||||
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
@ -8,8 +8,6 @@ Subject: [PATCH 4/5] black_hole: apply Fisher-Yates shuffle algorithm to
|
||||
plugin/executable/black_hole/black_hole.go | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/plugin/executable/black_hole/black_hole.go b/plugin/executable/black_hole/black_hole.go
|
||||
index 775253d..f955019 100644
|
||||
--- a/plugin/executable/black_hole/black_hole.go
|
||||
+++ b/plugin/executable/black_hole/black_hole.go
|
||||
@@ -27,6 +27,8 @@ import (
|
||||
@ -21,7 +19,7 @@ index 775253d..f955019 100644
|
||||
)
|
||||
|
||||
const PluginType = "black_hole"
|
||||
@@ -40,6 +42,7 @@ var _ sequence.Executable = (*BlackHole)(nil)
|
||||
@@ -40,6 +42,7 @@ var _ sequence.Executable = (*BlackHole)
|
||||
type BlackHole struct {
|
||||
ipv4 []netip.Addr
|
||||
ipv6 []netip.Addr
|
||||
@ -29,7 +27,7 @@ index 775253d..f955019 100644
|
||||
}
|
||||
|
||||
// QuickSetup format: [ipv4|ipv6] ...
|
||||
@@ -65,9 +68,21 @@ func NewBlackHole(ips []string) (*BlackHole, error) {
|
||||
@@ -65,9 +68,21 @@ func NewBlackHole(ips []string) (*BlackH
|
||||
return b, nil
|
||||
}
|
||||
|
||||
@ -51,6 +49,3 @@ index 775253d..f955019 100644
|
||||
if r := b.Response(qCtx.Q()); r != nil {
|
||||
qCtx.SetResponse(r)
|
||||
}
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
@ -7,8 +7,6 @@ Subject: [PATCH 5/5] format logtime
|
||||
mlog/logger.go | 18 ++++++++++++++----
|
||||
1 file changed, 14 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/mlog/logger.go b/mlog/logger.go
|
||||
index 861f091..1508db0 100644
|
||||
--- a/mlog/logger.go
|
||||
+++ b/mlog/logger.go
|
||||
@@ -21,9 +21,11 @@ package mlog
|
||||
@ -24,7 +22,7 @@ index 861f091..1508db0 100644
|
||||
)
|
||||
|
||||
type LogConfig struct {
|
||||
@@ -64,10 +66,18 @@ func NewLogger(lc LogConfig) (*zap.Logger, error) {
|
||||
@@ -64,10 +66,18 @@ func NewLogger(lc LogConfig) (*zap.Logge
|
||||
out = stderr
|
||||
}
|
||||
|
||||
@ -46,6 +44,3 @@ index 861f091..1508db0 100644
|
||||
}
|
||||
|
||||
// L is a global logger.
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user