🔥 Sync 2024-08-15 20:32:28

This commit is contained in:
github-actions[bot] 2024-08-15 20:32:28 +08:00
parent fec3c2ebdf
commit a920c6258c
16 changed files with 395 additions and 152 deletions

View File

@ -9,14 +9,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=accel-ppp
PKG_RELEASE:=6
PKG_RELEASE:=7
PKG_VERSION:=1.13.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/accel-ppp/accel-ppp.git
PKG_SOURCE_VERSION:=dbffa39b4304f1be5e099f056a9e5001c3100393
PKG_MAINTAINER:=Alex Paraskeva <sim201010@gmail.com>
PKG_MAINTAINER:=Konstantine Shevlakov <shevlakov@132lan.ru>
PKG_LICENSE:=GPL-2.0
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -26,6 +26,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
include $(INCLUDE_DIR)/kernel.mk
define Package/$(PKG_NAME)
SECTION:=net
@ -35,13 +36,14 @@ define Package/$(PKG_NAME)
endef
CMAKE_OPTIONS += \
-DBUILD_DRIVER=FALSE \
-DBUILD_IPOE_DRIVER=TRUE \
-DBUILD_VLAN_MON_DRIVER=TRUE \
-DKDIR=$(LINUX_DIR) \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DLOG_PGSQL=FALSE \
-DSHAPER=TRUE \
-DRADIUS=TRUE \
-DRADIUS=FALSE \
-DNETSNMP=FALSE \
-DLOG_FILE=TRUE \
-DLIB_SUFFIX= \
@ -50,15 +52,32 @@ CMAKE_BINARY_DIR := $(PKG_BUILD_DIR)/build
TARGET_CFLAGS += -I$(STAGING_DIR)/opt/include -D_GNU_SOURCE -g -O2 -Wno-incompatible-pointer-types
TARGET_LDFLAGS += -lpthread -latomic -lucontext
define KernelPackage/$(PKG_NAME)-ipoe
SUBMENU:= Accel-PPP kernel modules
TITLE:=Accel-PPP IPoE kernel module
DEPENDS:=+accel-ppp
FILES:=$(CMAKE_BINARY_DIR)/drivers/ipoe/driver/ipoe.ko
AUTOLOAD:=$(call AutoProbe,ipoe)
endef
define KernelPackage/$(PKG_NAME)-vlan-mon
SUBMENU:=Accel-PPP kernel modules
TITLE:=Accel-PPP vlan-mon kernel module
DEPENDS:=+accel-ppp
FILES:=$(CMAKE_BINARY_DIR)/drivers/vlan_mon/driver/vlan_mon.ko
AUTOLOAD:=$(call AutoProbe,vlan_mon)
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) \
$(1)/usr/sbin \
$(1)/usr/bin \
$(1)/usr/lib \
$(1)/usr/lib/accel-ppp \
$(1)/usr/share/accel-ppp \
$(1)/usr/share/accel-ppp/radius \
$(1)/usr/share/accel-ppp/l2tp \
$(1)/usr/lib/accel-ppp \
$(1)/etc/init.d \
$(1)/etc/accel-ppp
@ -74,10 +93,6 @@ define Package/$(PKG_NAME)/install
$(PKG_INSTALL_DIR)/usr/lib/accel-ppp/*.so \
$(1)/usr/lib/accel-ppp/
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/share/accel-ppp/radius/dictionary.* \
$(1)/usr/share/accel-ppp/radius/
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/share/accel-ppp/l2tp/dictionary.* \
$(1)/usr/share/accel-ppp/l2tp/
@ -93,13 +108,17 @@ define Package/$(PKG_NAME)/install
endef
define Package/$(PKG_NAME)/postinst
if [ -f /usr/lib/accel-ppp/libtriton.so ]; then
ln -s /usr/lib/accel-ppp/libtriton.so /usr/lib/
fi
for l in $$(ls -1 /usr/lib/accel-ppp/); do
ln -s /usr/lib/accel-ppp/$$l /usr/lib/
done
endef
define Package/$(PKG_NAME)/prerm
rm -rf /usr/lib/libtriton.so
for l in $$(ls -1 /usr/lib/accel-ppp/); do
rm -f /usr/lib/$$l
done
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call KernelPackage,$(PKG_NAME)-ipoe))
$(eval $(call KernelPackage,$(PKG_NAME)-vlan-mon))

View File

@ -1,21 +1,23 @@
[modules]
connlimit
log_file
#log_syslog
#log_tcp
#log_pgsql
pptp
l2tp
# L2TP not Work!
#l2tp
sstp
#pppoe
#ipoe
auth_mschap_v2
auth_mschap_v1
auth_chap_md5
auth_pap
#auth_mschap_v1
#auth_chap_md5
#auth_pap
radius
#chap-secrets
chap-secrets
ippool
@ -24,52 +26,61 @@ pppd_compat
#shaper
#net-snmp
#logwtmp
#connlimit
#ipv6_nd
#ipv6_dhcp
#ipv6pool
#net-accel-dp
[core]
log-error=/var/log/accel-ppp/core.log
log-error=/tmp/accel-ppp-core.log
thread-count=4
[common]
#single-session=replace
#single-session-ignore-case=0
#sid-case=upper
#sid-source=seq
#max-sessions=1000
#max-starting=0
#check-ip=0
#nl-snd-buffer=32768
#nl-rcv-buffer=1048576
[ppp]
verbose=1
min-mtu=1280
mtu=1400
mru=1400
#accomp=deny
#pcomp=deny
accomp=deny
pcomp=deny
#ccp=0
#check-ip=0
#mppe=require
mppe=require
ipv4=require
ipv6=deny
ipv6-intf-id=0:0:0:1
ipv6-peer-intf-id=0:0:0:2
ipv6-accept-peer-intf-id=1
lcp-echo-interval=20
#lcp-echo-failure=3
lcp-echo-failure=3
lcp-echo-timeout=120
unit-cache=1
#unit-preallocate=1
[auth]
#timeout=5
#interval=0
#max-failure=3
#any-login=0
#noauth=0
#challenge-name=accel-ppp
[pptp]
verbose=1
#echo-interval=30
ip-pool=pool3
#ipv6-pool=pptp
#ipv6-pool-delegate=pptp
ifname=pptp%d
[pppoe]
verbose=1
@ -81,11 +92,14 @@ called-sid=mac
#tr101=1
#padi-limit=0
#ip-pool=pppoe
#ipv6-pool=pppoe
#ipv6-pool-delegate=pppoe
#ifname=pppoe%d
#sid-uppercase=0
#vlan-mon=eth0,10-200
#vlan-timeout=60
#vlan-name=%I.%N
#interface=eth1,padi-limit=1000,net=accel-dp
#interface=eth1,padi-limit=1000
interface=eth0
[l2tp]
@ -103,13 +117,40 @@ verbose=1
#dataseq=allow
#reorder-timeout=0
#ip-pool=l2tp
#ipv6-pool=l2tp
#ipv6-pool-delegate=l2tp
#ifname=l2tp%d
[sstp]
verbose=2
#cert-hash-proto=sha1,sha256
#cert-hash-sha1=
#cert-hash-sha256=
#accept=ssl,proxy
#ssl-protocol=tls1,tls1.1,tls1.2,tls1.3
#ssl-dhparam=/etc/ssl/dhparam.pem
#ssl-ecdh-curve=prime256v1
#ssl-ciphers=DEFAULT
#ssl-prefer-server-ciphers=0
#ssl-ca-file=/etc/ssl/sstp-ca.crt
#ssl-pemfile=/etc/ssl/sstp-cert.pem
#ssl-keyfile=/etc/ssl/sstp-key.pem
#host-name=domain.tld
#http-error=allow
#timeout=60
#hello-interval=60
#ip-pool=sstp
#ipv6-pool=sstp
#ipv6-pool-delegate=sstp
ifname=sstp%d
[ipoe]
verbose=1
username=ifname
#password=username
lease-time=600
renew-time=600
#renew-time=300
#rebind-time=525
max-lease-time=3600
#unit-cache=1000
#l4-redirect-table=4
@ -120,17 +161,20 @@ shared=0
ifcfg=1
mode=L2
start=dhcpv4
#start=UP
#start=up
#ip-unnumbered=1
#proxy-arp=0
#nat=0
#proto=100
#relay=10.10.10.10
#vendor=Custom
#weight=0
#attr-dhcp-client-ip=DHCP-Client-IP-Address
#attr-dhcp-router-ip=DHCP-Router-IP-Address
#attr-dhcp-mask=DHCP-Mask
#attr-dhcp-lease-time=DHCP-Lease-Time
#attr-dhcp-renew-time=DHCP-Renewal-Time
#attr-dhcp-rebind-time=DHCP-Rebinding-Time
#attr-dhcp-opt82=DHCP-Option82
#attr-dhcp-opt82-remote-id=DHCP-Agent-Remote-Id
#attr-dhcp-opt82-circuit-id=DHCP-Agent-Circuit-Id
@ -143,6 +187,8 @@ start=dhcpv4
#vlan-timeout=60
#vlan-name=%I.%N
#ip-pool=ipoe
#ipv6-pool=ipoe
#ipv6-pool-delegate=ipoe
#idle-timeout=0
#session-timeout=0
#soft-terminate=0
@ -151,7 +197,6 @@ start=dhcpv4
#local-net=192.168.0.0/16
interface=eth0
[dns]
#dns1=172.16.0.1
#dns2=172.16.1.1
@ -172,11 +217,17 @@ verbose=1
#max-try=3
#acct-timeout=120
#acct-delay-time=0
#acct-delay-start=0
#acct-on=0
#acct-interim-interval=0
#acct-interim-jitter=0
#default-realm=
#strip-realm=0
#attr-tunnel-type=My-Tunnel-Type
#nas-port-id-in-req=1
[client-ip-range]
10.0.0.0/8
0.0.0.0/0
[ip-pool]
gw-ip-address=192.168.0.1
@ -187,12 +238,13 @@ attr=Framed-Pool
192.168.1.1-255,name=pool1
192.168.2.1-255,name=pool2
192.168.3.1-255,name=pool3
192.168.4.1-255,name=pool4,next=pool1
192.168.4.0/24
[log]
log-file=/var/log/accel-ppp/accel-ppp.log
log-emerg=/var/log/accel-ppp/emerg.log
log-fail-file=/var/log/accel-ppp/auth-fail.log
log-file=/tmp/accel-ppp.log
log-emerg=/tmpaccel-ppp-emerg.log
log-fail-file=/tmp/accel-ppp-auth-fail.log
#log-debug=/dev/stdout
#syslog=accel-pppd,daemon
#log-tcp=127.0.0.1:3000
@ -201,19 +253,20 @@ copy=1
#per-user-dir=per_user
#per-session-dir=per_session
#per-session=1
level=3
level=7
[log-pgsql]
conninfo=user=log
log-table=log
[pppd-compat]
verbose=1
#ip-pre-up=/etc/ppp/ip-pre-up
ip-up=/etc/ppp/ip-up
ip-down=/etc/ppp/ip-down
ip-change=/etc/ppp/ip-change
#ip-change=/etc/ppp/ip-change
radattr-prefix=/var/run/radattr
verbose=1
#fork-limit=16
[chap-secrets]
gw-ip-address=192.168.100.1
@ -239,6 +292,7 @@ down-limiter=tbf
#leaf-qdisc=fq_codel [limit PACKETS] [flows NUMBER] [target TIME] [interval TIME] [quantum BYTES] [[no]ecn]
#rate-multiplier=1
#fwmark=1
#rate-limit=2048/1024
verbose=1
[cli]
@ -246,6 +300,7 @@ verbose=1
telnet=127.0.0.1:2000
tcp=127.0.0.1:2001
#password=123
#sessions-columns=ifname,username,ip,ip6,ip6-dp,type,state,uptime,uptime-raw,calling-sid,called-sid,sid,comp,inbound-if,service-name,rx-bytes,tx-bytes,rx-bytes-raw,tx-bytes-raw,rx-pkts,tx-pkts,netns,vrf
[snmp]
master=0
@ -257,8 +312,16 @@ burst=3
timeout=60
[ipv6-pool]
#gw-ip6-address=fc00:0:1::1
#vendor=
#attr-prefix=Delegated-IPv6-Prefix-Pool
#attr-address=Stateful-IPv6-Address-Pool
fc00:0:1::/48,64
fc00:0:2::/48,64,name=pool1
fc00:0:3::/48,64,name=pool2,next=pool1
delegate=fc00:1::/36,48
delegate=fc00:2::/36,48,name=pool3
delegate=fc00:3::/36,48,name=pool4,next=pool3
[ipv6-dns]
#fc00:1::1
@ -272,6 +335,3 @@ verbose=1
pref-lifetime=604800
valid-lifetime=2592000
route-via-gw=1
[accel-dp]
socket=/var/run/accel-dp.sock

View File

@ -6,11 +6,16 @@ USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/sbin/accel-pppd -d -c /etc/accel-ppp/accel-ppp.conf
procd_set_param command /usr/sbin/accel-pppd -d -c /etc/accel-ppp/accel-ppp.conf -p /var/run/accel-pppd.pid
procd_set_param respawn
procd_close_instance
}
stop_service(){
killall -3 accel-pppd >/dev/null 2>&1
rm -rf /var/run/accel-pppd.pid
}
reload_service() {
procd_send_signal accel-ppp
}

View File

@ -1,27 +1,53 @@
--- a/accel-pppd/ctrl/ipoe/arp.c
+++ b/accel-pppd/ctrl/ipoe/arp.c
@@ -13,7 +13,6 @@
Index: accel-ppp-1.13.0/accel-pppd/ctrl/ipoe/arp.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ctrl/ipoe/arp.c
+++ accel-ppp-1.13.0/accel-pppd/ctrl/ipoe/arp.c
@@ -13,8 +13,8 @@
#include <netinet/ip.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
-#include <linux/if_arp.h>
#include <linux/if_packet.h>
-#include <linux/if_packet.h>
+#include <net/if_arp.h>
+#include <netpacket/packet.h>
#include "list.h"
#include "triton.h"
--- a/accel-pppd/ctrl/ipoe/ipoe.c.orig
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -15,7 +15,6 @@
Index: accel-ppp-1.13.0/accel-pppd/ctrl/ipoe/ipoe.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ctrl/ipoe/ipoe.c
+++ accel-ppp-1.13.0/accel-pppd/ctrl/ipoe/ipoe.c
@@ -15,7 +15,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
+#include <net/if_arp.h>
#include <linux/route.h>
#include <pcre.h>
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -11,7 +11,6 @@
Index: accel-ppp-1.13.0/accel-pppd/ctrl/l2tp/l2tp.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ctrl/l2tp/l2tp.c
+++ accel-ppp-1.13.0/accel-pppd/ctrl/l2tp/l2tp.c
@@ -853,7 +853,7 @@ static void l2tp_tunnel_free_sessions(st
void *sessions = conn->sessions;
conn->sessions = NULL;
- tdestroy(sessions, (__free_fn_t)l2tp_session_free);
+ tdestroy(sessions, (void (*) (void *))l2tp_session_free);
/* Let l2tp_session_free() handle the session counter and
* the reference held by the tunnel.
*/
Index: accel-ppp-1.13.0/accel-pppd/ctrl/pppoe/pppoe.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ctrl/pppoe/pppoe.c
+++ accel-ppp-1.13.0/accel-pppd/ctrl/pppoe/pppoe.c
@@ -8,10 +8,10 @@
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <linux/sockios.h>
#include <net/ethernet.h>
#include <netpacket/packet.h>
#include <arpa/inet.h>
@ -29,8 +55,29 @@
#include "crypto.h"
--- a/accel-pppd/include/ap_session.h
+++ b/accel-pppd/include/ap_session.h
Index: accel-ppp-1.13.0/accel-pppd/ifcfg.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ifcfg.c
+++ accel-ppp-1.13.0/accel-pppd/ifcfg.c
@@ -9,6 +9,7 @@
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <linux/sockios.h>
#include <linux/route.h>
#include "linux_ppp.h"
@@ -376,4 +377,4 @@ int __export ap_session_vrf(struct ap_se
return 0;
}
-#endif
\ No newline at end of file
+#endif
Index: accel-ppp-1.13.0/accel-pppd/include/ap_session.h
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/include/ap_session.h
+++ accel-ppp-1.13.0/accel-pppd/include/ap_session.h
@@ -5,6 +5,7 @@
#include "triton.h"
@ -39,8 +86,66 @@
//#define AP_SESSIONID_LEN 16
#define AP_IFNAME_LEN 16
--- a/accel-pppd/session_backup.c
+++ b/accel-pppd/session_backup.c
@@ -124,9 +125,9 @@ struct ap_session
struct ap_session_stat
{
- unsigned int active;
- unsigned int starting;
- unsigned int finishing;
+ uint32_t active;
+ uint32_t starting;
+ uint32_t finishing;
};
Index: accel-ppp-1.13.0/accel-pppd/ppp/ppp.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/ppp/ppp.c
+++ accel-ppp-1.13.0/accel-pppd/ppp/ppp.c
@@ -10,6 +10,7 @@
#include <signal.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <linux/sockios.h>
#include "linux_ppp.h"
#include "crypto.h"
Index: accel-ppp-1.13.0/accel-pppd/session.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/session.c
+++ accel-ppp-1.13.0/accel-pppd/session.c
@@ -105,7 +105,7 @@ int __export ap_session_starting(struct
ses->state = AP_STATE_STARTING;
}
- __sync_add_and_fetch(&ap_session_stat.starting, 1);
+ __sync_add_and_fetch_4(&ap_session_stat.starting, 1);
pthread_rwlock_wrlock(&ses_lock);
list_add_tail(&ses->entry, &ses_list);
@@ -296,7 +296,7 @@ void __export ap_session_terminate(struc
else
__sync_sub_and_fetch(&ap_session_stat.starting, 1);
- __sync_add_and_fetch(&ap_session_stat.finishing, 1);
+ __sync_add_and_fetch_4(&ap_session_stat.finishing, 1);
ses->terminating = 1;
ses->state = AP_STATE_FINISHING;
@@ -354,7 +354,7 @@ static void generate_sessionid(struct ap
sid = ++seq;
spin_unlock(&seq_lock);
#else
- sid = __sync_add_and_fetch(&seq, 1);
+ sid = __sync_add_and_fetch_4(&seq, 1);
#endif
clock_gettime(CLOCK_MONOTONIC, &ts);
Index: accel-ppp-1.13.0/accel-pppd/session_backup.c
===================================================================
--- accel-ppp-1.13.0.orig/accel-pppd/session_backup.c
+++ accel-ppp-1.13.0/accel-pppd/session_backup.c
@@ -5,6 +5,7 @@
#include <unistd.h>
#include <netinet/in.h>

View File

@ -1,11 +0,0 @@
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -853,7 +853,7 @@ static void l2tp_tunnel_free_sessions(st
void *sessions = conn->sessions;
conn->sessions = NULL;
- tdestroy(sessions, (__free_fn_t)l2tp_session_free);
+ tdestroy(sessions, l2tp_session_free);
/* Let l2tp_session_free() handle the session counter and
* the reference held by the tunnel.
*/

View File

@ -24,7 +24,7 @@ o.rmempty=false
o=s:option(Value,"speed",translate("Broadband speed"))
o.description =translate("100M broadband download speed is about 12M/s. It is not recommended to fill in an excessively large value, and it may run all the time.");
o.datatype ="uinteger"
o.datatype ="uinteger"
o.rmempty=false
o=s:option(Value,"custome_url",translate("Custome Url"))
@ -59,46 +59,46 @@ o.default = 0
o.rmempty=false
o = s:option(Value, "threads", translate("Thread"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 200
o.rmempty=true
o:depends("advanced", 1)
o = s:option(Value, "tl", translate("Average Latency Cap"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 200
o.rmempty=true
o:depends("advanced", 1)
o = s:option(Value, "tll", translate("Average Latency Lower Bound"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 40
o.rmempty=true
o:depends("advanced", 1)
o = s:option(Value, "t", translate("Delayed speed measurement time"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 4
o.rmempty=true
o:depends("advanced", 1)
o = s:option(Value, "dt", translate("Download speed test time"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 10
o.rmempty=true
o:depends("advanced", 1)
o = s:option(Value, "dn", translate("Number of download speed tests"))
o.datatype ="uinteger"
o.datatype ="uinteger"
o.default = 1
o.rmempty=true
o:depends("advanced", 1)
o:depends("advanced", 1)
o = s:option(Flag, "dd", translate("Disable download speed test"))
o.default = 0
o.rmempty=true
o:depends("advanced", 1)
o:depends("advanced", 1)
o = s:option(Value, "tp", translate("Port"))
o.rmempty=true
o.default = 443
@ -112,10 +112,10 @@ o.template = "cloudflarespeedtest/actions"
s = m:section(NamedSection, "servers", "section", translate("Third party applications settings"))
if nixio.fs.access("/etc/config/shadowsocksr") then
s:tab("ssr", translate("Shadowsocksr Plus+"))
s:tab("ssr", translate("Shadowsocksr Plus+"))
o=s:taboption("ssr", Flag, "ssr_enabled",translate("Shadowsocksr Plus+ Enabled"))
o.rmempty=true
o.rmempty=true
local ssr_server_table = {}
uci:foreach("shadowsocksr", "servers", function(s)
@ -136,7 +136,7 @@ if nixio.fs.access("/etc/config/shadowsocksr") then
o = s:taboption("ssr", DynamicList, "ssr_services",
translate("Shadowsocksr Servers"),
translate("Please select a service"))
for _, key in pairs(ssr_key_table) do
o:value(key, ssr_server_table[key])
end
@ -150,7 +150,7 @@ if nixio.fs.access("/etc/config/passwall") then
s:tab("passwalltab", translate("passwall"))
o=s:taboption("passwalltab", Flag, "passwall_enabled",translate("Passwall Enabled"))
o.rmempty=true
o.rmempty=true
local passwall_server_table = {}
uci:foreach("passwall", "nodes", function(s)
@ -169,7 +169,7 @@ if nixio.fs.access("/etc/config/passwall") then
o = s:taboption("passwalltab", DynamicList, "passwall_services",
translate("Passwall Servers"),
translate("Please select a service"))
for _, key in pairs(passwall_key_table) do
o:value(key, passwall_server_table[key])
end
@ -182,7 +182,7 @@ if nixio.fs.access("/etc/config/passwall2") then
s:tab("passwall2tab", translate("passwall2"))
o=s:taboption("passwall2tab", Flag, "passwall2_enabled",translate("PassWall2 Enabled"))
o.rmempty=true
o.rmempty=true
local passwall2_server_table = {}
uci:foreach("passwall2", "nodes", function(s)
@ -201,7 +201,7 @@ if nixio.fs.access("/etc/config/passwall2") then
o = s:taboption("passwall2tab", DynamicList, "passwall2_services",
translate("Passwall2 Servers"),
translate("Please select a service"))
for _, key in pairs(passwall2_key_table) do
o:value(key, passwall2_server_table[key])
end
@ -212,9 +212,9 @@ end
s:tab("bypasstab", translate("Bypass"))
if nixio.fs.access("/etc/config/bypass") then
o=s:taboption("bypasstab", Flag, "bypass_enabled",translate("Bypass Enabled"))
o.rmempty=true
o.rmempty=true
local bypass_server_table = {}
uci:foreach("bypass", "servers", function(s)
@ -235,7 +235,7 @@ if nixio.fs.access("/etc/config/bypass") then
o = s:taboption("bypasstab", DynamicList, "bypass_services",
translate("Bypass Servers"),
translate("Please select a service"))
for _, key in pairs(bypass_key_table) do
o:value(key, bypass_server_table[key])
end
@ -246,9 +246,9 @@ end
s:tab("vssrtab", translate("Vssr"))
if nixio.fs.access("/etc/config/vssr") then
o=s:taboption("vssrtab", Flag, "vssr_enabled",translate("Vssr Enabled"))
o.rmempty=true
o.rmempty=true
local vssr_server_table = {}
uci:foreach("vssr", "servers", function(s)
@ -269,7 +269,7 @@ if nixio.fs.access("/etc/config/vssr") then
o = s:taboption("vssrtab", DynamicList, "vssr_services",
translate("Vssr Servers"),
translate("Please select a service"))
for _, key in pairs(vssr_key_table) do
o:value(key, vssr_server_table[key])
end
@ -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"

View File

@ -114,7 +114,7 @@ msgstr "启用IPv6"
msgid "Delayed speed measurement time"
msgstr "延迟测速次数"
msgid "Download speed test time"
msgstr "下载测速时间"
@ -136,7 +136,7 @@ msgstr "IPv4和IPv6只能选一个"
msgid "<a href=\"https://github.com/XIU2/CloudflareSpeedTest/issues/168\" target=\"_blank\">How to create</a>"
msgstr "<a href=\"https://github.com/XIU2/CloudflareSpeedTest/issues/168\" target=\"_blank\">如何创建</a>"
msgid "RUNNING"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
@ -219,3 +219,9 @@ msgstr "启用HOST"
msgid "Domain"
msgstr "域名"
msgid "MosDNS Enabled"
msgstr "写入 MosDNS"
msgid "OpenClash Restart"
msgstr "重启 OpenClash"

View File

@ -114,7 +114,7 @@ msgstr "启用IPv6"
msgid "Delayed speed measurement time"
msgstr "延迟测速次数"
msgid "Download speed test time"
msgstr "下载测速时间"
@ -136,7 +136,7 @@ msgstr "IPv4和IPv6只能选一个"
msgid "<a href=\"https://github.com/XIU2/CloudflareSpeedTest/issues/168\" target=\"_blank\">How to create</a>"
msgstr "<a href=\"https://github.com/XIU2/CloudflareSpeedTest/issues/168\" target=\"_blank\">如何创建</a>"
msgid "RUNNING"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
@ -219,3 +219,9 @@ msgstr "启用HOST"
msgid "Domain"
msgstr "域名"
msgid "MosDNS Enabled"
msgstr "写入 MosDNS"
msgid "OpenClash Restart"
msgstr "重启 OpenClash"

View File

@ -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(){
@ -39,17 +39,17 @@ function appinit(){
}
function speed_test(){
rm -rf $LOG_FILE
command="/usr/bin/cdnspeedtest -sl $((speed*125/1000)) -url ${custome_url} -o ${IP_FILE}"
if [ $ipv6_enabled -eq "1" ] ;then
command="${command} -f ${IPV6_TXT}"
else
command="${command} -f ${IPV4_TXT}"
fi
if [ $advanced -eq "1" ] ; then
command="${command} -tl ${tl} -tll ${tll} -n ${threads} -t ${t} -dt ${dt} -dn ${dn}"
if [ $dd -eq "1" ] ; then
@ -61,9 +61,9 @@ function speed_test(){
else
command="${command} -tl 200 -tll 40 -n 200 -t 4 -dt 10 -dn 1"
fi
appinit
ssr_original_server=$(uci get shadowsocksr.@global[0].global_server 2>/dev/null)
ssr_original_run_mode=$(uci get shadowsocksr.@global[0].run_mode 2>/dev/null)
if [ "x${ssr_original_server}" != "xnil" ] && [ "x${ssr_original_server}" != "x" ] ;then
@ -76,7 +76,7 @@ function speed_test(){
uci commit shadowsocksr
/etc/init.d/shadowsocksr restart
fi
passwall_server_enabled=$(uci get passwall.@global[0].enabled 2>/dev/null)
passwall_original_run_mode=$(uci get passwall.@global[0].tcp_proxy_mode 2>/dev/null)
if [ "x${passwall_server_enabled}" == "x1" ] ;then
@ -89,7 +89,7 @@ function speed_test(){
uci commit passwall
/etc/init.d/passwall restart 2>/dev/null
fi
passwall2_server_enabled=$(uci get passwall2.@global[0].enabled 2>/dev/null)
passwall2_original_run_mode=$(uci get passwall2.@global[0].tcp_proxy_mode 2>/dev/null)
if [ "x${passwall2_server_enabled}" == "x1" ] ;then
@ -102,11 +102,11 @@ function speed_test(){
uci commit passwall2
/etc/init.d/passwall2 restart 2>/dev/null
fi
vssr_original_server=$(uci get vssr.@global[0].global_server 2>/dev/null)
vssr_original_run_mode=$(uci get vssr.@global[0].run_mode 2>/dev/null)
if [ "x${vssr_original_server}" != "xnil" ] && [ "x${vssr_original_server}" != "x" ] ;then
if [ $proxy_mode == "close" ] ;then
uci set vssr.@global[0].global_server="nil"
elif [ $proxy_mode == "gfw" ] ;then
@ -116,7 +116,7 @@ function speed_test(){
uci commit vssr
/etc/init.d/vssr restart
fi
bypass_original_server=$(uci get bypass.@global[0].global_server 2>/dev/null)
bypass_original_run_mode=$(uci get bypass.@global[0].run_mode 2>/dev/null)
if [ "x${bypass_original_server}" != "x" ] ;then
@ -129,7 +129,20 @@ function speed_test(){
uci commit bypass
/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
@ -137,13 +150,14 @@ function speed_test(){
}
function ip_replace(){
# 获取最快 IP从 result.csv 结果文件中获取第一个 IP
bestip=$(sed -n "2,1p" $IP_FILE | awk -F, '{print $1}')
if [[ -z "${bestip}" ]]; then
echolog "CloudflareST 测速结果 IP 数量为 0,跳过下面步骤..."
else
host_ip
mosdns_ip
alidns_ip
ssr_best_ip
vssr_best_ip
@ -151,7 +165,7 @@ function ip_replace(){
passwall_best_ip
passwall2_best_ip
restart_app
fi
}
@ -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"
@ -246,7 +280,7 @@ function restart_app(){
/etc/init.d/shadowsocksr restart &>/dev/null
echolog "ssr重启完成"
fi
if [ "x${passwall_started}" == "x1" ] ;then
if [ $proxy_mode == "close" ] ;then
uci set passwall.@global[0].enabled="${passwall_server_enabled}"
@ -257,7 +291,7 @@ function restart_app(){
/etc/init.d/passwall restart 2>/dev/null
echolog "passwall重启完成"
fi
if [ "x${passwall2_started}" == "x1" ] ;then
if [ $proxy_mode == "close" ] ;then
uci set passwall2.@global[0].enabled="${passwall2_server_enabled}"
@ -268,7 +302,7 @@ function restart_app(){
/etc/init.d/passwall2 restart 2>/dev/null
echolog "passwall2重启完成"
fi
if [ "x${vssr_started}" == "x1" ] ;then
if [ $proxy_mode == "close" ] ;then
uci set vssr.@global[0].global_server="${vssr_original_server}"
@ -279,7 +313,7 @@ function restart_app(){
/etc/init.d/vssr restart &>/dev/null
echolog "Vssr重启完成"
fi
if [ "x${bypass_started}" == "x1" ] ;then
if [ $proxy_mode == "close" ] ;then
uci set bypass.@global[0].global_server="${bypass_original_server}"

View File

@ -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') + '&#160;' + v,
_('MosDNS is a plugin-based DNS forwarder/traffic splitter.'));
s = m.section(form.TypedSection);

View File

@ -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": {

View File

@ -101,11 +101,15 @@ return view.extend({
o.default = o.disabled;
o.rmempty = false;
o = s.option(form.Value, 'def_tcp_stun', _('Default ') + _('TCP STUN ') + _('Server'));
o = s.option(form.Value, 'def_tcp_stun', _('Default ') + _('TCP STUN ') + _('Server'),
_('Available server <a href="%s" target="_blank">references</a>')
.format(_('https://github.com/muink/rfc5780-stun-server/blob/master/valid_hosts_rfc5780.txt')));
o.datatype = 'or(hostname, hostport)';
o.rmempty = false;
o = s.option(form.Value, 'def_udp_stun', _('Default ') + _('UDP STUN ') + _('Server'));
o = s.option(form.Value, 'def_udp_stun', _('Default ') + _('UDP STUN ') + _('Server'),
_('Available server <a href="%s" target="_blank">references</a>')
.format(_('https://github.com/muink/rfc5780-stun-server/blob/master/valid_hosts_rfc5780_tcp.txt')));
o.datatype = 'or(hostname, hostport)';
o.rmempty = false;
@ -521,9 +525,9 @@ return view.extend({
o = s.taboption('notify', form.DynamicList, 'notify_tokens', _('Tokens'),
_('The KEY required by the script above. ' +
'See <a href="%s" target="_blank">%s*</a> for the format of KEY required by each script. ' +
'See <a href="%s" target="_blank">%s</a> for the format of KEY required by each script. ' +
'Add multiple entries here in KEY=VAL shell variable format to supply multiple KEY variables.')
.format('https://github.com/muink/openwrt-natmapt/tree/master/files/notify/'));
.format('https://github.com/muink/openwrt-natmapt/tree/master/files/notify/', _('<code># All external tokens required</code> Field')));
o.datatype = 'list(string)';
o.placeholder = 'KEY=VAL';
o.rmempty = true;
@ -557,9 +561,9 @@ return view.extend({
o = s.taboption('ddns', form.DynamicList, 'ddns_tokens', _('Tokens'),
_('The KEY required by the script above. ' +
'See <a href="%s" target="_blank">%s*</a> for the format of KEY required by each script. ' +
'See <a href="%s" target="_blank">%s</a> for the format of KEY required by each script. ' +
'Add multiple entries here in KEY=VAL shell variable format to supply multiple KEY variables.')
.format('https://github.com/muink/openwrt-natmapt/tree/master/files/ddns/'));
.format('https://github.com/muink/openwrt-natmapt/tree/master/files/ddns/', _('<code># All external tokens required</code> Field')));
o.datatype = 'list(string)';
o.placeholder = 'KEY=VAL';
o.rmempty = true;

View File

@ -18,6 +18,11 @@ msgstr "(此装置默认 LAN)"
msgid "(This device default Wan)"
msgstr "(此装置默认 WAN)"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:530
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:566
msgid "<code># All external tokens required</code> Field"
msgstr "<code># All external tokens required</code> 字段"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:562
msgid "A Record"
msgstr "A 记录"
@ -30,6 +35,11 @@ msgstr "AAAA 记录"
msgid "Active NATMap Portmap"
msgstr "活动的 NATMap 端口映射"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:105
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:111
msgid "Available server <a href=\"%s\" target=\"_blank\">references</a>"
msgstr "可用的服务器<a href=\"%s\" target=\"_blank\">参考</a>"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:304
msgid "Bind port"
msgstr "绑定端口"
@ -243,7 +253,7 @@ msgstr "密码"
msgid ""
"Please check <a href=\"%s\"><b>Firewall Rules</b></a> to avoid port "
"conflicts.</br>"
msgstr "请检查<a href=\"%s\"><b>防火墙规则</b></a>以避免端口冲突"
msgstr "请检查<a href=\"%s\"><b>防火墙规则</b></a>以避免端口冲突</br>"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:362
msgid "Port forwarding session idle timeout in seconds"
@ -338,11 +348,11 @@ msgstr "DNAT 方法不支持在 IPv6 下使用"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:553
msgid ""
"The KEY required by the script above. See <a href=\"%s\" "
"target=\"_blank\">%s*</a> for the format of KEY required by each script. Add "
"target=\"_blank\">%s</a> for the format of KEY required by each script. Add "
"multiple entries here in KEY=VAL shell variable format to supply multiple "
"KEY variables."
msgstr ""
"上面脚本所需的 KEY。请查看 <a href=\"%s\" target=\"_blank\">%s*</a> 以获得对"
"上面脚本所需的 KEY。请查看 <a href=\"%s\" target=\"_blank\">%s</a> 以获得对"
"应脚本所需的 KEY 列表。请输入格式为 KEY=VAL 的多个 KEY 条目"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/status/include/72_natmap.js:83

View File

@ -18,6 +18,11 @@ msgstr "(本裝置默認 LAN)"
msgid "(This device default Wan)"
msgstr "(本裝置默認 WAN)"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:530
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:566
msgid "<code># All external tokens required</code> Field"
msgstr "<code># All external tokens required</code> 字段"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:562
msgid "A Record"
msgstr "A 記錄"
@ -30,6 +35,11 @@ msgstr "AAAA 記錄"
msgid "Active NATMap Portmap"
msgstr "活動的 NATMap 埠映射"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:105
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:111
msgid "Available server <a href=\"%s\" target=\"_blank\">references</a>"
msgstr "可用的伺服器<a href=\"%s\" target=\"_blank\">參考</a>"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:304
msgid "Bind port"
msgstr "綁定埠"
@ -243,7 +253,7 @@ msgstr "密碼"
msgid ""
"Please check <a href=\"%s\"><b>Firewall Rules</b></a> to avoid port "
"conflicts.</br>"
msgstr "請檢查<a href=\"%s\"><b>防火牆規則</b></a>以避免埠衝突"
msgstr "請檢查<a href=\"%s\"><b>防火牆規則</b></a>以避免埠衝突</br>"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:362
msgid "Port forwarding session idle timeout in seconds"
@ -338,11 +348,11 @@ msgstr "DNAT 方法不支援在 IPv6 下使用"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/natmap.js:553
msgid ""
"The KEY required by the script above. See <a href=\"%s\" "
"target=\"_blank\">%s*</a> for the format of KEY required by each script. Add "
"target=\"_blank\">%s</a> for the format of KEY required by each script. Add "
"multiple entries here in KEY=VAL shell variable format to supply multiple "
"KEY variables."
msgstr ""
"上面腳本所需的 KEY。請參閱 <a href=\"%s\" target=\"_blank\">%s*</a> 以獲得對"
"上面腳本所需的 KEY。請參閱 <a href=\"%s\" target=\"_blank\">%s</a> 以獲得對"
"應腳本所需的 KEY 清單。請輸入格式為 KEY=VAL 的多個 KEY 條目"
#: applications/luci-app-natmapt/htdocs/luci-static/resources/view/status/include/72_natmap.js:83

View File

@ -118,9 +118,6 @@ return view.extend({
o.placeholder = 'packagesync';
o.rmempty = false;
o.validate = function(section, value) {
if (value == null || value == '' || value == 'ignore')
return _('Expecting: non-empty value');
if (usedname.length)
for (var i = 0; i < usedname.length; i++)
if (usedname[i] == value)
@ -273,9 +270,6 @@ return view.extend({
o.datatype = 'uciname';
o.rmempty = false;
o.validate = function(section_id, value) {
if (value == null || value == '' || value == 'ignore')
return _('Expecting: non-empty value');
let ss = uci.sections(conf, release);
for (var i = 0; i < ss.length; i++) {
let sid = ss[i]['.name'];
@ -304,11 +298,6 @@ return view.extend({
o = s.option(form.Value, 'version', _('Version'));
o.rmempty = false;
o.validate = function(section, value) {
if (value == null || value == '' || value == 'ignore')
return _('Expecting: non-empty value');
return true;
};
if (releaseslist.length) {
for (var i = 0; i < releaseslist.length; i++)
@ -318,11 +307,6 @@ return view.extend({
o = s.option(form.Value, 'target', _('Target'));
o.placeholder = 'x86/64';
o.rmempty = false;
o.validate = function(section, value) {
if (value == null || value == '' || value == 'ignore')
return _('Expecting: non-empty value');
return true;
};
if (targetslist.length) {
for (var i = 0; i < targetslist.length; i++)
@ -336,11 +320,6 @@ return view.extend({
o = s.option(form.Value, 'pkgarch', _('Arch'));
o.rmempty = false;
o.validate = function(section, value) {
if (value == null || value == '' || value == 'ignore')
return _('Expecting: non-empty value');
return true;
};
if (pkgarchslist.length) {
for (var i = 0; i < pkgarchslist.length; i++)