Merge Mainline
This commit is contained in:
commit
ead018693c
@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
|
||||
include $(INCLUDE_DIR)/feeds.mk
|
||||
|
||||
PKG_NAME:=base-files
|
||||
PKG_RELEASE:=206
|
||||
PKG_RELEASE:=210
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
|
||||
|
||||
@ -5,7 +5,7 @@ CFG=$1
|
||||
[ -n "$CFG" ] || CFG=/etc/board.json
|
||||
|
||||
[ -d "/etc/board.d/" -a ! -s "$CFG" ] && {
|
||||
for a in `ls /etc/board.d/*`; do
|
||||
for a in $(ls /etc/board.d/*); do
|
||||
[ -x $a ] || continue;
|
||||
$(. $a)
|
||||
done
|
||||
|
||||
@ -20,6 +20,7 @@ generate_static_network() {
|
||||
uci -q batch <<-EOF
|
||||
delete network.globals
|
||||
set network.globals='globals'
|
||||
set network.globals.ula_prefix='auto'
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -84,12 +85,16 @@ generate_network() {
|
||||
set network.$1.proto='none'
|
||||
EOF
|
||||
|
||||
[ -n "$macaddr" ] && uci -q batch <<-EOF
|
||||
delete network.$1_dev
|
||||
set network.$1_dev='device'
|
||||
set network.$1_dev.name='$ifname'
|
||||
set network.$1_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
if [ -n "$macaddr" ]; then
|
||||
for name in $ifname; do
|
||||
uci -q batch <<-EOF
|
||||
delete network.$1_${name/./_}_dev
|
||||
set network.$1_${name/./_}_dev='device'
|
||||
set network.$1_${name/./_}_dev.name='$name'
|
||||
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
|
||||
case "$protocol" in
|
||||
static)
|
||||
|
||||
@ -37,6 +37,8 @@ set_led_state() {
|
||||
;;
|
||||
done)
|
||||
status_led_off
|
||||
[ "$status_led" != "$running" ] && \
|
||||
status_led_restore_trigger "boot"
|
||||
[ -n "$running" ] && {
|
||||
status_led="$running"
|
||||
status_led_on
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
root:x:0:
|
||||
daemon:x:1:
|
||||
adm:x:4:
|
||||
tty:x:5:
|
||||
mail:x:8:
|
||||
dialout:x:20:
|
||||
audio:x:29:
|
||||
www-data:x:33:
|
||||
ftp:x:55:
|
||||
|
||||
@ -20,7 +20,6 @@ uci_apply_defaults() {
|
||||
boot() {
|
||||
[ -f /proc/mounts ] || /sbin/mount_root
|
||||
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
|
||||
[ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
|
||||
|
||||
mkdir -p /var/run
|
||||
mkdir -p /var/log
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
START=95
|
||||
boot() {
|
||||
mount_root done
|
||||
rm -f /sysupgrade.tgz
|
||||
rm -f /sysupgrade.tgz && sync
|
||||
|
||||
# process user commands
|
||||
[ -f /etc/rc.local ] && {
|
||||
|
||||
@ -6,7 +6,7 @@ USE_PROCD=1
|
||||
|
||||
validate_system_section()
|
||||
{
|
||||
uci_validate_section system system "${1}" \
|
||||
uci_load_validate system system "$1" "$2" \
|
||||
'hostname:string:OpenWrt' \
|
||||
'conloglevel:uinteger' \
|
||||
'buffersize:uinteger' \
|
||||
@ -15,11 +15,7 @@ validate_system_section()
|
||||
}
|
||||
|
||||
system_config() {
|
||||
local cfg="$1"
|
||||
|
||||
local hostname conloglevel buffersize timezone zonename
|
||||
|
||||
validate_system_section "${1}" || {
|
||||
[ "$2" = 0 ] || {
|
||||
echo "validation failed"
|
||||
return 1
|
||||
}
|
||||
@ -31,12 +27,12 @@ system_config() {
|
||||
ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ
|
||||
|
||||
# apply timezone to kernel
|
||||
date -k
|
||||
busybox date -k
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
config_load system
|
||||
config_foreach system_config system
|
||||
config_foreach validate_system_section system system_config
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
|
||||
STOP=99
|
||||
STOP=90
|
||||
|
||||
restart() {
|
||||
:
|
||||
}
|
||||
|
||||
stop() {
|
||||
sync
|
||||
/bin/umount -a -d -r
|
||||
|
||||
12
package/base-files/files/etc/rc.button/reboot
Executable file
12
package/base-files/files/etc/rc.button/reboot
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "released" ] || exit 0
|
||||
|
||||
if [ "$SEEN" -ge 5 ]
|
||||
then
|
||||
echo "REBOOT" > /dev/console
|
||||
sync
|
||||
reboot
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -73,6 +73,7 @@ Available commands:
|
||||
reload Reload configuration files (or restart if service does not implement reload)
|
||||
enable Enable service autostart
|
||||
disable Disable service autostart
|
||||
enabled Check if service is started on boot
|
||||
$EXTRA_HELP
|
||||
EOF
|
||||
}
|
||||
@ -95,7 +96,9 @@ service_data() {
|
||||
}
|
||||
|
||||
service_running() {
|
||||
return 0
|
||||
local service="${1:-$(basename $initscript)}"
|
||||
local instance="${2:-*}"
|
||||
procd_running "$service" "$instance" "$@"
|
||||
}
|
||||
|
||||
${INIT_TRACE:+set -x}
|
||||
@ -103,7 +106,11 @@ ${INIT_TRACE:+set -x}
|
||||
. "$initscript"
|
||||
|
||||
[ -n "$USE_PROCD" ] && {
|
||||
EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace"
|
||||
EXTRA_COMMANDS="${EXTRA_COMMANDS} running status trace"
|
||||
EXTRA_HELP="\
|
||||
running Check if service is running
|
||||
status Service status
|
||||
${EXTRA_HELP}"
|
||||
|
||||
. $IPKG_INSTROOT/lib/functions/procd.sh
|
||||
basescript=$(readlink "$initscript")
|
||||
@ -131,6 +138,9 @@ ${INIT_TRACE:+set -x}
|
||||
procd_lock
|
||||
stop_service "$@"
|
||||
procd_kill "$(basename ${basescript:-$initscript})" "$1"
|
||||
if eval "type service_stopped" 2>/dev/null >/dev/null; then
|
||||
service_stopped
|
||||
fi
|
||||
}
|
||||
|
||||
reload() {
|
||||
@ -145,6 +155,14 @@ ${INIT_TRACE:+set -x}
|
||||
running() {
|
||||
service_running "$@"
|
||||
}
|
||||
|
||||
status() {
|
||||
if eval "type status_service" 2>/dev/null >/dev/null; then
|
||||
status_service "$@"
|
||||
else
|
||||
_procd_status "$(basename ${basescript:-$initscript})" "$1"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
for file in `grep -sl Require-User /usr/lib/opkg/info/*.control`; do
|
||||
for file in $(grep -sl Require-User /usr/lib/opkg/info/*.control); do
|
||||
file="${file##*/}"
|
||||
file="${file%.control}"
|
||||
add_group_and_user "${file}"
|
||||
|
||||
@ -1,17 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
|
||||
get_dt_led() {
|
||||
local label
|
||||
get_dt_led_path() {
|
||||
local ledpath
|
||||
local basepath="/proc/device-tree"
|
||||
local nodepath="$basepath/aliases/led-$1"
|
||||
|
||||
[ -f "$nodepath" ] && ledpath=$(cat "$nodepath")
|
||||
[ -n "$ledpath" ] && ledpath="$basepath$ledpath"
|
||||
|
||||
echo "$ledpath"
|
||||
}
|
||||
|
||||
get_dt_led() {
|
||||
local label
|
||||
local ledpath=$(get_dt_led_path $1)
|
||||
|
||||
[ -n "$ledpath" ] && \
|
||||
label=$(cat "$basepath$ledpath/label" 2>/dev/null) || \
|
||||
label=$(cat "$basepath$ledpath/chan-name" 2>/dev/null) || \
|
||||
label=$(basename "$basepath$ledpath")
|
||||
label=$(cat "$ledpath/label" 2>/dev/null) || \
|
||||
label=$(cat "$ledpath/chan-name" 2>/dev/null) || \
|
||||
label=$(basename "$ledpath")
|
||||
|
||||
echo "$label"
|
||||
}
|
||||
@ -36,6 +44,17 @@ led_off() {
|
||||
led_set_attr $1 "brightness" 0
|
||||
}
|
||||
|
||||
status_led_restore_trigger() {
|
||||
local trigger
|
||||
local ledpath=$(get_dt_led_path $1)
|
||||
|
||||
[ -n "$ledpath" ] && \
|
||||
trigger=$(cat "$ledpath/linux,default-trigger" 2>/dev/null)
|
||||
|
||||
[ -n "$trigger" ] && \
|
||||
led_set_attr "$(get_dt_led $1)" "trigger" "$trigger"
|
||||
}
|
||||
|
||||
status_led_set_timer() {
|
||||
led_timer $status_led "$1" "$2"
|
||||
[ -n "$status_led2" ] && led_timer $status_led2 "$1" "$2"
|
||||
|
||||
@ -271,6 +271,11 @@ network_is_up()
|
||||
# 2: interface
|
||||
network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; }
|
||||
|
||||
# determine the uptime of the given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
network_get_uptime() { __network_ifstatus "$1" "$2" ".uptime"; }
|
||||
|
||||
# determine the metric of the given logical interface
|
||||
# 1: destination variable
|
||||
# 2: interface
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
# Copyright (C) 2006-2013 OpenWrt.org
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
get_mac_binary() {
|
||||
local path="$1"
|
||||
local offset="$2"
|
||||
|
||||
if [ -z "$path" ]; then
|
||||
if ! [ -e "$path" ]; then
|
||||
echo "get_mac_binary: file $path not found!" >&2
|
||||
return
|
||||
fi
|
||||
@ -12,6 +15,44 @@ get_mac_binary() {
|
||||
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' $path 2>/dev/null
|
||||
}
|
||||
|
||||
get_mac_label_dt() {
|
||||
local basepath="/proc/device-tree"
|
||||
local macdevice="$(cat "$basepath/aliases/label-mac-device" 2>/dev/null)"
|
||||
local macaddr
|
||||
|
||||
[ -n "$macdevice" ] || return
|
||||
|
||||
macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
|
||||
[ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null)
|
||||
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
get_mac_label_json() {
|
||||
local cfg="/etc/board.json"
|
||||
local macaddr
|
||||
|
||||
[ -s "$cfg" ] || return
|
||||
|
||||
json_init
|
||||
json_load "$(cat $cfg)"
|
||||
if json_is_a system object; then
|
||||
json_select system
|
||||
json_get_var macaddr label_macaddr
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
get_mac_label() {
|
||||
local macaddr=$(get_mac_label_dt)
|
||||
|
||||
[ -n "$macaddr" ] || macaddr=$(get_mac_label_json)
|
||||
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
find_mtd_chardev() {
|
||||
local INDEX=$(find_mtd_index "$1")
|
||||
local PREFIX=/dev/mtd
|
||||
@ -79,12 +120,7 @@ mtd_get_mac_binary_ubi() {
|
||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||
local part=$(nand_find_volume $ubidev $1)
|
||||
|
||||
if [ -z "$part" ]; then
|
||||
echo "mtd_get_mac_binary: ubi volume $mtdname not found!" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
hexdump -v -n 6 -s $offset -e '5/1 "%02x:" 1/1 "%02x"' /dev/$part 2>/dev/null
|
||||
get_mac_binary "/dev/$part" "$offset"
|
||||
}
|
||||
|
||||
mtd_get_part_size() {
|
||||
@ -105,7 +141,7 @@ macaddr_add() {
|
||||
local oui=${mac%:*:*:*}
|
||||
local nic=${mac#*:*:*:}
|
||||
|
||||
nic=$(printf "%06x" $((0x${nic//:/} + $val & 0xffffff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
|
||||
nic=$(printf "%06x" $((0x${nic//:/} + val & 0xffffff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
|
||||
echo $oui:$nic
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ failsafe_wait() {
|
||||
preinit_net_echo "Please press button now to enter failsafe"
|
||||
pi_failsafe_net_message=false
|
||||
fs_wait_for_key f 'to enter failsafe mode' $fs_failsafe_wait_timeout && FAILSAFE=true
|
||||
[ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "`cat /tmp/failsafe_button`" was pressed -"
|
||||
[ -f "/tmp/failsafe_button" ] && FAILSAFE=true && echo "- failsafe button "$(cat /tmp/failsafe_button)" was pressed -"
|
||||
[ "$FAILSAFE" = "true" ] && export FAILSAFE && touch /tmp/failsafe
|
||||
fi
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ do_mount_root() {
|
||||
echo "- config restore -"
|
||||
cd /
|
||||
tar xzf /sysupgrade.tgz
|
||||
# Prevent configuration corruption on a power loss
|
||||
sync
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=perf
|
||||
PKG_VERSION:=$(LINUX_VERSION)
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
@ -53,6 +53,7 @@ MAKE_FLAGS = \
|
||||
NO_LIBAUDIT=1 \
|
||||
NO_LIBCRYPTO=1 \
|
||||
NO_LIBUNWIND=1 \
|
||||
NO_LIBZSTD=1 \
|
||||
NO_LIBCAP=1 \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
|
||||
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=trace-cmd
|
||||
PKG_VERSION:=v2.6.1
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/
|
||||
@ -31,6 +31,7 @@ endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
NO_PYTHON=1 \
|
||||
NO_AUDIT=1 \
|
||||
prefix=/usr
|
||||
|
||||
PLUGINS_DIR := $(PKG_INSTALL_DIR)/usr/lib/trace-cmd/plugins
|
||||
|
||||
@ -191,10 +191,10 @@ define KernelPackage/sound-soc-core
|
||||
KCONFIG:= \
|
||||
CONFIG_SND_SOC \
|
||||
CONFIG_SND_SOC_ADI=n \
|
||||
CONFIG_SND_SOC_DMAENGINE_PCM=y \
|
||||
CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y \
|
||||
CONFIG_SND_SOC_ALL_CODECS=n
|
||||
FILES:=$(LINUX_DIR)/sound/soc/snd-soc-core.ko
|
||||
AUTOLOAD:=$(call AutoLoad,55, snd-soc-core)
|
||||
AUTOLOAD:=$(call AutoLoad,55,snd-soc-core)
|
||||
$(call AddDepends/sound)
|
||||
endef
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=3.9
|
||||
PKG_RELEASE:=68
|
||||
PKG_DATE:=20201006
|
||||
PKG_RELEASE:=70
|
||||
PKG_DATE:=20201009
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local uci = require"luci.model.uci".cursor()
|
||||
local util = require "luci.util"
|
||||
local datatypes = require "luci.cbi.datatypes"
|
||||
local i18n = require "luci.i18n"
|
||||
|
||||
appname = "passwall"
|
||||
@ -14,6 +15,33 @@ command_timeout = 300
|
||||
LEDE_BOARD = nil
|
||||
DISTRIB_TARGET = nil
|
||||
|
||||
function get_valid_nodes()
|
||||
local nodes = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks then
|
||||
if e.type == "V2ray" and (e.protocol == "_balancing" or e.protocol == "_shunt") then
|
||||
e.remarks_name = "%s:[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks}
|
||||
e.node_type = "special"
|
||||
nodes[#nodes + 1] = e
|
||||
end
|
||||
if e.port and e.address then
|
||||
local address = e.address
|
||||
if datatypes.ipaddr(address) or datatypes.hostname(address) then
|
||||
local address2 = address
|
||||
if datatypes.ip6addr(address) then address2 = "[" .. address .. "]" end
|
||||
e.remarks_name = "%s:[%s] %s:%s" % {e.type, e.remarks, address2, e.port}
|
||||
if e.use_kcp and e.use_kcp == "1" then
|
||||
e.remarks_name = "%s+%s:[%s] %s" % {e.type, "Kcptun", e.remarks, address2}
|
||||
end
|
||||
e.node_type = "normal"
|
||||
nodes[#nodes + 1] = e
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
return nodes
|
||||
end
|
||||
|
||||
function gen_uuid(format)
|
||||
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
|
||||
if format == nil then
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
module("luci.model.cbi.passwall.api.gen_v2ray", package.seeall)
|
||||
local ucursor = require"luci.model.uci".cursor()
|
||||
local sys = require "luci.sys"
|
||||
local json = require "luci.jsonc"
|
||||
local appname = "passwall"
|
||||
local node_section = arg[1]
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local node_section = arg[1] or "nil"
|
||||
local proto = arg[2]
|
||||
local redir_port = arg[3]
|
||||
local socks_proxy_port = arg[4]
|
||||
local node = ucursor:get_all(appname, node_section)
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local network = proto
|
||||
local routing = nil
|
||||
local new_port
|
||||
|
||||
local function get_new_port()
|
||||
@ -22,7 +24,7 @@ local function get_new_port()
|
||||
return new_port
|
||||
end
|
||||
|
||||
local function gen_outbound(node, tag, relay_port)
|
||||
function gen_outbound(node, tag, relay_port)
|
||||
local result = nil
|
||||
if node then
|
||||
local node_id = node[".name"]
|
||||
@ -145,159 +147,160 @@ local function gen_outbound(node, tag, relay_port)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
if socks_proxy_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(socks_proxy_port),
|
||||
protocol = "socks",
|
||||
settings = {auth = "noauth", udp = true, ip = "127.0.0.1"}
|
||||
})
|
||||
network = "tcp,udp"
|
||||
end
|
||||
|
||||
if redir_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
port = tonumber(redir_port),
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = proto, followRedirect = true},
|
||||
sniffing = {enabled = true, destOverride = {"http", "tls"}}
|
||||
})
|
||||
if proto == "tcp" and node.tcp_socks == "1" then
|
||||
if node then
|
||||
if socks_proxy_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(node.tcp_socks_port),
|
||||
port = tonumber(socks_proxy_port),
|
||||
protocol = "socks",
|
||||
settings = {
|
||||
auth = node.tcp_socks_auth,
|
||||
accounts = (node.tcp_socks_auth == "password") and {
|
||||
{
|
||||
user = node.tcp_socks_auth_username,
|
||||
pass = node.tcp_socks_auth_password
|
||||
}
|
||||
} or nil,
|
||||
udp = true
|
||||
}
|
||||
settings = {auth = "noauth", udp = true, ip = "127.0.0.1"}
|
||||
})
|
||||
network = "tcp,udp"
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "_shunt" then
|
||||
local rules = {}
|
||||
ucursor:foreach(appname, "shunt_rules", function(e)
|
||||
local name = e[".name"]
|
||||
local _node_id = node[name] or nil
|
||||
if _node_id and _node_id ~= "nil" then
|
||||
local _node = ucursor:get_all(appname, _node_id)
|
||||
local is_proxy = node[name .. "_proxy"]
|
||||
local relay_port
|
||||
if is_proxy and is_proxy == "1" then
|
||||
new_port = get_new_port()
|
||||
relay_port = new_port
|
||||
table.insert(inbounds, {
|
||||
tag = "proxy_" .. name,
|
||||
listen = "127.0.0.1",
|
||||
port = new_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = "tcp,udp", address = _node.address, port = tonumber(_node.port)}
|
||||
})
|
||||
if _node.tls_serverName == nil then
|
||||
_node.tls_serverName = _node.address
|
||||
end
|
||||
_node.address = "127.0.0.1"
|
||||
_node.port = new_port
|
||||
end
|
||||
local _outbound = gen_outbound(_node, name, relay_port)
|
||||
if _outbound then
|
||||
table.insert(outbounds, _outbound)
|
||||
if redir_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
port = tonumber(redir_port),
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = proto, followRedirect = true},
|
||||
sniffing = {enabled = true, destOverride = {"http", "tls"}}
|
||||
})
|
||||
if proto == "tcp" and node.tcp_socks == "1" then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(node.tcp_socks_port),
|
||||
protocol = "socks",
|
||||
settings = {
|
||||
auth = node.tcp_socks_auth,
|
||||
accounts = (node.tcp_socks_auth == "password") and {
|
||||
{
|
||||
user = node.tcp_socks_auth_username,
|
||||
pass = node.tcp_socks_auth_password
|
||||
}
|
||||
} or nil,
|
||||
udp = true
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "_shunt" then
|
||||
local rules = {}
|
||||
ucursor:foreach(appname, "shunt_rules", function(e)
|
||||
local name = e[".name"]
|
||||
local _node_id = node[name] or nil
|
||||
if _node_id and _node_id ~= "nil" then
|
||||
local _node = ucursor:get_all(appname, _node_id)
|
||||
local is_proxy = node[name .. "_proxy"]
|
||||
local relay_port
|
||||
if is_proxy and is_proxy == "1" then
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
inboundTag = {"proxy_" .. name},
|
||||
outboundTag = "default"
|
||||
new_port = get_new_port()
|
||||
relay_port = new_port
|
||||
table.insert(inbounds, {
|
||||
tag = "proxy_" .. name,
|
||||
listen = "127.0.0.1",
|
||||
port = new_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = "tcp,udp", address = _node.address, port = tonumber(_node.port)}
|
||||
})
|
||||
if _node.tls_serverName == nil then
|
||||
_node.tls_serverName = _node.address
|
||||
end
|
||||
_node.address = "127.0.0.1"
|
||||
_node.port = new_port
|
||||
end
|
||||
if e.domain_list then
|
||||
local _domain = {}
|
||||
string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_domain, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
domain = _domain
|
||||
})
|
||||
end
|
||||
if e.ip_list then
|
||||
local _ip = {}
|
||||
string.gsub(e.ip_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_ip, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
ip = _ip
|
||||
})
|
||||
local _outbound = gen_outbound(_node, name, relay_port)
|
||||
if _outbound then
|
||||
table.insert(outbounds, _outbound)
|
||||
if is_proxy and is_proxy == "1" then
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
inboundTag = {"proxy_" .. name},
|
||||
outboundTag = "default"
|
||||
})
|
||||
end
|
||||
if e.domain_list then
|
||||
local _domain = {}
|
||||
string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_domain, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
domain = _domain
|
||||
})
|
||||
end
|
||||
if e.ip_list then
|
||||
local _ip = {}
|
||||
string.gsub(e.ip_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_ip, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
ip = _ip
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local default_node_id = node.default_node or nil
|
||||
if default_node_id and default_node_id ~= "nil" then
|
||||
local default_node = ucursor:get_all(appname, default_node_id)
|
||||
local default_outbound = gen_outbound(default_node, "default")
|
||||
if default_outbound then
|
||||
table.insert(outbounds, default_outbound)
|
||||
local rule = {
|
||||
type = "field",
|
||||
outboundTag = "default",
|
||||
network = network
|
||||
}
|
||||
table.insert(rules, rule)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local default_node_id = node.default_node or nil
|
||||
if default_node_id and default_node_id ~= "nil" then
|
||||
local default_node = ucursor:get_all(appname, default_node_id)
|
||||
local default_outbound = gen_outbound(default_node, "default")
|
||||
if default_outbound then
|
||||
table.insert(outbounds, default_outbound)
|
||||
local rule = {
|
||||
type = "field",
|
||||
outboundTag = "default",
|
||||
network = network
|
||||
|
||||
routing = {domainStrategy = "IPOnDemand", rules = rules}
|
||||
|
||||
elseif node.protocol == "_balancing" then
|
||||
if node.balancing_node then
|
||||
local nodes = node.balancing_node
|
||||
local length = #nodes
|
||||
for i = 1, length do
|
||||
local node = ucursor:get_all(appname, nodes[i])
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
routing = {
|
||||
domainStrategy = "IPOnDemand",
|
||||
balancers = {{tag = "balancer", selector = nodes}},
|
||||
rules = {
|
||||
{type = "field", network = "tcp,udp", balancerTag = "balancer"}
|
||||
}
|
||||
}
|
||||
table.insert(rules, rule)
|
||||
end
|
||||
else
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
|
||||
routing = {domainStrategy = "IPOnDemand", rules = rules}
|
||||
-- 额外传出连接
|
||||
table.insert(outbounds, {protocol = "freedom", tag = "direct", settings = {keep = ""}})
|
||||
|
||||
elseif node.protocol == "_balancing" then
|
||||
if node.balancing_node then
|
||||
local nodes = node.balancing_node
|
||||
local length = #nodes
|
||||
for i = 1, length do
|
||||
local node = ucursor:get_all(appname, nodes[i])
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
routing = {
|
||||
domainStrategy = "IPOnDemand",
|
||||
balancers = {{tag = "balancer", selector = nodes}},
|
||||
rules = {
|
||||
{type = "field", network = "tcp,udp", balancerTag = "balancer"}
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
routing = routing
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
end
|
||||
|
||||
-- 额外传出连接
|
||||
table.insert(outbounds, {protocol = "freedom", tag = "direct", settings = {keep = ""}})
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
routing = routing
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
local uci = require"luci.model.uci".cursor()
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local appname = "passwall"
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks then
|
||||
local remarks = ""
|
||||
if e.type == "V2ray" and (e.protocol == "_balancing" or e.protocol == "_shunt") then
|
||||
remarks = "%s:[%s] " % {translatef(e.type .. e.protocol), e.remarks}
|
||||
else
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
end
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = remarks
|
||||
}
|
||||
end
|
||||
end)
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = e.remarks_name
|
||||
}
|
||||
end
|
||||
|
||||
m = Map(appname)
|
||||
|
||||
|
||||
@ -4,24 +4,12 @@ local api = require "luci.model.cbi.passwall.api.api"
|
||||
local appname = "passwall"
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks then
|
||||
local remarks = ""
|
||||
if e.type == "V2ray" and (e.protocol == "_balancing" or e.protocol == "_shunt") then
|
||||
remarks = "%s:[%s] " % {translatef(e.type .. e.protocol), e.remarks}
|
||||
else
|
||||
if e.use_kcp and e.use_kcp == "1" then
|
||||
remarks = "%s+%s:[%s] %s" % {e.type, "Kcptun", e.remarks, e.address}
|
||||
else
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
end
|
||||
end
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = remarks
|
||||
}
|
||||
end
|
||||
end)
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = e.remarks_name
|
||||
}
|
||||
end
|
||||
|
||||
local socks_table = {}
|
||||
uci:foreach(appname, "socks", function(s)
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
local e = require "luci.sys"
|
||||
local net = require "luci.model.network".init()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local appname = "passwall"
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks and e.port and e.address and e.address ~= "127.0.0.1" then
|
||||
if e.address:match("[\u4e00-\u9fa5]") and e.address:find("%.") and e.address:sub(#e.address) ~= "." then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = "%s:[%s] %s:%s" % {translate(e.type), e.remarks, e.address, e.port},
|
||||
obj = e
|
||||
}
|
||||
end
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
if e.node_type == "normal" then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
obj = e,
|
||||
remarks = e.remarks_name
|
||||
}
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
m = Map(appname)
|
||||
|
||||
|
||||
@ -112,16 +112,14 @@ protocol:value("_shunt", translate("Shunt"))
|
||||
protocol:depends("type", "V2ray")
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks and e.port then
|
||||
if e.address:match("[\u4e00-\u9fa5]") and e.address:find("%.") and e.address:sub(#e.address) ~= "." then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
}
|
||||
end
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
if e.node_type == "normal" then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = e.remarks_name
|
||||
}
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- 负载均衡列表
|
||||
balancing_node = s:option(DynamicList, "balancing_node", translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>document</a>"))
|
||||
|
||||
@ -149,24 +149,4 @@ o:value("big_icon", translate("Big icon")) -- 大图标
|
||||
o:value("show_check_port", translate("Show node check")) -- 显示节点检测
|
||||
o:value("show_ip111", translate("Show Show IP111")) -- 显示IP111
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
if e.type and e.remarks then
|
||||
local remarks = ""
|
||||
if e.type == "V2ray" and (e.protocol == "_balancing" or e.protocol == "_shunt") then
|
||||
remarks = "%s:[%s] " % {translatef(e.type .. e.protocol), e.remarks}
|
||||
else
|
||||
if e.use_kcp and e.use_kcp == "1" then
|
||||
remarks = "%s+%s:[%s] %s" % {e.type, "Kcptun", e.remarks, e.address}
|
||||
else
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
end
|
||||
end
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = remarks
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
||||
return m
|
||||
|
||||
@ -87,105 +87,9 @@ function gen_config(user)
|
||||
}
|
||||
|
||||
if user.transit_node and user.transit_node ~= "nil" then
|
||||
local node = ucic:get_all("passwall", user.transit_node)
|
||||
if node and node ~= "nil" and node.type and node.type == "V2ray" then
|
||||
if node.transport == "mkcp" or node.transport == "quic" then
|
||||
node.stream_security = "none"
|
||||
end
|
||||
local transit_node = {
|
||||
tag = "transit",
|
||||
protocol = node.protocol,
|
||||
mux = {
|
||||
enabled = (node.mux == "1") and true or false,
|
||||
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
|
||||
},
|
||||
-- 底层传输配置
|
||||
streamSettings = {
|
||||
network = node.transport,
|
||||
security = node.stream_security,
|
||||
xtlsSettings = (node.stream_security == "xtls") and {
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tlsSettings = (node.stream_security == "tls") and {
|
||||
disableSessionResumption = node.sessionTicket ~= "1" and true or false,
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tcpSettings = (node.transport == "tcp") and {
|
||||
header = {
|
||||
type = node.tcp_guise,
|
||||
request = (node.tcp_guise == "http") and {
|
||||
path = node.tcp_guise_http_path or {"/"},
|
||||
headers = {
|
||||
Host = node.tcp_guise_http_host or {}
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
} or nil,
|
||||
kcpSettings = (node.transport == "mkcp") and {
|
||||
mtu = tonumber(node.mkcp_mtu),
|
||||
tti = tonumber(node.mkcp_tti),
|
||||
uplinkCapacity = tonumber(node.mkcp_uplinkCapacity),
|
||||
downlinkCapacity = tonumber(node.mkcp_downlinkCapacity),
|
||||
congestion = (node.mkcp_congestion == "1") and true or false,
|
||||
readBufferSize = tonumber(node.mkcp_readBufferSize),
|
||||
writeBufferSize = tonumber(node.mkcp_writeBufferSize),
|
||||
seed = (node.mkcp_seed and node.mkcp_seed ~= "") and node.mkcp_seed or nil,
|
||||
header = {type = node.mkcp_guise}
|
||||
} or nil,
|
||||
wsSettings = (node.transport == "ws") and {
|
||||
path = node.ws_path or "",
|
||||
headers = (node.ws_host ~= nil) and {Host = node.ws_host} or nil
|
||||
} or nil,
|
||||
httpSettings = (node.transport == "h2") and {
|
||||
path = node.h2_path, host = node.h2_host
|
||||
} or nil,
|
||||
dsSettings = (node.transport == "ds") and {
|
||||
path = node.ds_path
|
||||
} or nil,
|
||||
quicSettings = (node.transport == "quic") and {
|
||||
security = node.quic_security,
|
||||
key = node.quic_key,
|
||||
header = {type = node.quic_guise}
|
||||
} or nil
|
||||
},
|
||||
settings = {
|
||||
vnext = (node.protocol == "vmess" or node.protocol == "vless") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
users = {
|
||||
{
|
||||
id = node.uuid,
|
||||
alterId = tonumber(node.alter_id),
|
||||
level = node.level and tonumber(node.level) or 0,
|
||||
security = (node.protocol == "vmess") and node.security or nil,
|
||||
encryption = node.encryption or "none",
|
||||
flow = (node.stream_security == "xtls") and node.flow or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
servers = (node.protocol == "http" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
method = node.v_ss_encrypt_method,
|
||||
password = node.password or "",
|
||||
users = (node.username and node.password) and
|
||||
{
|
||||
{
|
||||
user = node.username or "",
|
||||
pass = node.password or ""
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
}
|
||||
table.insert(outbounds, 1, transit_node)
|
||||
end
|
||||
local gen_v2ray = require("luci.model.cbi.passwall.api.gen_v2ray")
|
||||
local client = gen_v2ray.gen_outbound(ucic:get_all("passwall", user.transit_node), "transit")
|
||||
table.insert(outbounds, 1, client)
|
||||
end
|
||||
|
||||
local config = {
|
||||
|
||||
@ -514,14 +514,14 @@ ss_aead_pwd.rmempty = false
|
||||
ss_aead_pwd:depends("ss_aead", "1")
|
||||
|
||||
local nodes_table = {}
|
||||
uci:foreach("passwall", "nodes", function(e)
|
||||
if e.type and e.type == "V2ray" and e.remarks and e.address and e.port then
|
||||
for k, e in ipairs(api.get_valid_nodes()) do
|
||||
if e.node_type == "normal" and e.type == "V2ray" then
|
||||
nodes_table[#nodes_table + 1] = {
|
||||
id = e[".name"],
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
remarks = e.remarks_name
|
||||
}
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
transit_node = s:option(ListValue, "transit_node", translate("transit node"))
|
||||
transit_node:value("nil", translate("Close"))
|
||||
|
||||
@ -12,8 +12,8 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=6fdf971c9dbf7dac9bea552113fe4694015bbc4d
|
||||
PKG_MIRROR_HASH:=80998023c237bd0eaa38554e18536d8f66223e97fc5ade015a2d2aadf587d1f0
|
||||
PKG_SOURCE_VERSION:=32965a46ce978f271ec6d3745f951da111c8e74a
|
||||
PKG_MIRROR_HASH:=f4d2e53aef57412740536fc9aea6cdcebc4b2b50461343f4eb438d507705e046
|
||||
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user