From d8650247eb1c1ff1a67c2b65e342fd1b496d2410 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Mon, 19 Jan 2026 16:38:09 +0800 Subject: [PATCH] update 2026-01-19 16:38:09 --- luci-app-kai/Makefile | 2 +- luci-app-passwall2/Makefile | 2 +- .../root/usr/share/passwall2/app.sh | 52 ++++++++-------- nikki/files/ucode/hijack.ut | 6 +- services/kai/Makefile | 5 +- services/kai/files/kai.init | 30 ++++----- services/kai_session/Makefile | 62 +++++++++++++++++++ v2ray-geodata/Makefile | 4 +- 8 files changed, 110 insertions(+), 53 deletions(-) create mode 100644 services/kai_session/Makefile diff --git a/luci-app-kai/Makefile b/luci-app-kai/Makefile index 2b0bc94c7..70a542397 100755 --- a/luci-app-kai/Makefile +++ b/luci-app-kai/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=kai PKG_VERSION:=1.0.0 PKG_RELEASE:=0 -LUCI_DEPENDS:=+kai +LUCI_DEPENDS:=+kai +kai_session LUCI_MINIFY_CSS:=0 LUCI_MINIFY_JS:=0 diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 6b50c61e8..7d021f2cb 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 -PKG_VERSION:=26.1.18 +PKG_VERSION:=26.1.19 PKG_RELEASE:=1 PKG_PO_VERSION:=$(PKG_VERSION) diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index 24cea8176..f8a9233e2 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -14,6 +14,8 @@ UTIL_XRAY=$LUA_UTIL_PATH/util_xray.lua UTIL_NAIVE=$LUA_UTIL_PATH/util_naiveproxy.lua UTIL_HYSTERIA2=$LUA_UTIL_PATH/util_hysteria2.lua UTIL_TUIC=$LUA_UTIL_PATH/util_tuic.lua +SINGBOX_BIN=$(first_type $(config_t_get global_app sing_box_file) sing-box) +XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray) check_run_environment() { local prefer_nft=$(config_t_get global_forwarding prefer_nft 1) @@ -74,12 +76,6 @@ run_xray() { local loglevel log_file config_file local _extra_param="" eval_set_val $@ - local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') - if [ "$type" != "xray" ]; then - local bin=$(first_type $(config_t_get global_app xray_file) xray) - [ -n "$bin" ] && type="xray" - fi - [ -z "$type" ] && return 1 [ -n "$log_file" ] || local log_file="/dev/null" [ -z "$loglevel" ] && local loglevel=$(config_t_get global loglevel "warning") [ -n "$flag" ] && pgrep -af "$TMP_BIN_PATH" | awk -v P1="${flag}" 'BEGIN{IGNORECASE=1}$0~P1{print $1}' | xargs kill -9 >/dev/null 2>&1 @@ -167,7 +163,7 @@ run_xray() { DNS_REMOTE_ARGS="${DNS_REMOTE_ARGS} -dns_out_tag remote -dns_listen_port ${dns_remote_listen_port} -remote_dns_outbound_socks_address 127.0.0.1 -remote_dns_outbound_socks_port ${socks_port}" lua $UTIL_XRAY gen_dns_config ${DNS_REMOTE_ARGS} > $V2RAY_DNS_REMOTE_CONFIG - ln_run "$(first_type $(config_t_get global_app ${type}_file) ${type})" ${type} $V2RAY_DNS_REMOTE_LOG run -c "$V2RAY_DNS_REMOTE_CONFIG" + ln_run "$XRAY_BIN" "xray" $V2RAY_DNS_REMOTE_LOG run -c "$V2RAY_DNS_REMOTE_CONFIG" _extra_param="${_extra_param} -remote_dns_udp_port ${dns_remote_listen_port} -remote_dns_udp_server 127.0.0.1 -remote_dns_query_strategy ${remote_dns_query_strategy}" fi } @@ -178,7 +174,13 @@ run_xray() { } lua $UTIL_XRAY gen_config -node $node -loglevel $loglevel ${_extra_param} > $config_file - ln_run "$(first_type $(config_t_get global_app ${type}_file) ${type})" ${type} $log_file run -c "$config_file" + + $XRAY_BIN run -test -c "$config_file" > $log_file; local status=$? + if [ "${status}" == 0 ]; then + ln_run "$XRAY_BIN" xray $log_file run -c "$config_file" + else + return ${status} + fi } run_singbox() { @@ -199,8 +201,7 @@ run_singbox() { [ -z "$loglevel" ] && local loglevel=$(config_t_get global loglevel "warn") [ "$loglevel" = "warning" ] && loglevel="warn" _extra_param="${_extra_param} -loglevel $loglevel" - - _extra_param="${_extra_param} -tags $($(first_type $(config_t_get global_app sing_box_file) sing-box) version | grep 'Tags:' | awk '{print $2}')" + _extra_param="${_extra_param} -tags $($SINGBOX_BIN version | grep 'Tags:' | awk '{print $2}')" [ -n "$flag" ] && pgrep -af "$TMP_BIN_PATH" | awk -v P1="${flag}" 'BEGIN{IGNORECASE=1}$0~P1{print $1}' | xargs kill -9 >/dev/null 2>&1 [ -n "$flag" ] && _extra_param="${_extra_param} -flag $flag" @@ -284,7 +285,13 @@ run_singbox() { } lua $UTIL_SINGBOX gen_config -node $node ${_extra_param} > $config_file - ln_run "$(first_type $(config_t_get global_app sing_box_file) sing-box)" "sing-box" "${log_file}" run -c "$config_file" + + $SINGBOX_BIN check -c "$config_file" > $log_file 2>&1; local status=$? + if [ "${status}" == 0 ]; then + ln_run "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file" + else + return ${status} + fi } run_socks() { @@ -347,7 +354,7 @@ run_socks() { } [ -n "$no_run" ] && _extra_param="${_extra_param} -no_run 1" lua $UTIL_SINGBOX gen_config -flag SOCKS_$flag -node $node -local_socks_address $bind -local_socks_port $socks_port ${_extra_param} > $config_file - [ -n "$no_run" ] || ln_run "$(first_type $(config_t_get global_app sing_box_file) sing-box)" "sing-box" /dev/null run -c "$config_file" + [ -n "$no_run" ] || ln_run "$SINGBOX_BIN" "sing-box" /dev/null run -c "$config_file" ;; xray) [ "$http_port" != "0" ] && { @@ -358,7 +365,7 @@ run_socks() { [ -n "$relay_port" ] && _extra_param="${_extra_param} -server_host $server_host -server_port $server_port" [ -n "$no_run" ] && _extra_param="${_extra_param} -no_run 1" lua $UTIL_XRAY gen_config -flag SOCKS_$flag -node $node -local_socks_address $bind -local_socks_port $socks_port ${_extra_param} > $config_file - [ -n "$no_run" ] || ln_run "$(first_type $(config_t_get global_app xray_file) xray)" "xray" $log_file run -c "$config_file" + [ -n "$no_run" ] || ln_run "$XRAY_BIN" "xray" $log_file run -c "$config_file" ;; naiveproxy) lua $UTIL_NAIVE gen_config -node $node -run_type socks -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $server_port > $config_file @@ -407,13 +414,13 @@ run_socks() { # http to socks [ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && { - local bin=$(first_type $(config_t_get global_app sing_box_file) sing-box) + local bin=$SINGBOX_BIN if [ -n "$bin" ]; then type="sing-box" lua $UTIL_SINGBOX gen_proto_config -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file [ -n "$no_run" ] || ln_run "$bin" ${type} /dev/null run -c "$http_config_file" else - bin=$(first_type $(config_t_get global_app xray_file) xray) + bin=$XRAY_BIN [ -n "$bin" ] && type="xray" [ -z "$type" ] && return 1 lua $UTIL_XRAY gen_proto_config -local_http_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file @@ -533,12 +540,9 @@ run_global() { run_func="run_singbox" fi - ${run_func} ${V2RAY_ARGS} + ${run_func} ${V2RAY_ARGS}; local status=$? - sleep 1s - - netstat -tuln | grep "LISTEN" | grep "${REDIR_PORT}" >/dev/null; REDIR_PORT_STATUS=$? - if [ "$REDIR_PORT_STATUS" == 0 ]; then + if [ "$status" == 0 ]; then log 0 ${dns_msg} else log_i18n 0 "[%s] process %s error, skip!" $(i18n "Global") "${V2RAY_CONFIG}" @@ -937,9 +941,8 @@ acl_app() { remote_dns_protocol=${remote_dns_protocol} remote_dns_tcp_server=${remote_dns} remote_dns_udp_server=${remote_dns} remote_dns_doh="${remote_dns}" \ remote_dns_client_ip=${remote_dns_client_ip} remote_dns_detour=${remote_dns_detour} remote_fakedns=${remote_fakedns} remote_dns_query_strategy=${remote_dns_query_strategy} \ write_ipset_direct=${write_ipset_direct} config_file=${config_file} - sleep 1s - netstat -tuln | grep "LISTEN" | grep "${redir_port}" >/dev/null; redir_port_status=$? - if [ "$redir_port_status" != 0 ]; then + local status=$? + if [ "$status" != 0 ]; then log_i18n 2 "[%s] process %s error, skip!" "${remarks}" "${config_file}" continue fi @@ -1107,9 +1110,6 @@ get_config() { fi set_cache_var GLOBAL_DNSMASQ_CONF ${DNSMASQ_CONF_DIR}/dnsmasq-${CONFIG}.conf set_cache_var GLOBAL_DNSMASQ_CONF_PATH ${GLOBAL_ACL_PATH}/dnsmasq.d - - XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray) - SINGBOX_BIN=$(first_type $(config_t_get global_app sing_box_file) sing-box) } arg1=$1 diff --git a/nikki/files/ucode/hijack.ut b/nikki/files/ucode/hijack.ut index faf9646f0..5a90eb372 100644 --- a/nikki/files/ucode/hijack.ut +++ b/nikki/files/ucode/hijack.ut @@ -474,10 +474,10 @@ table inet nikki { meta nfproto @proxy_nfproto jump router_redirect {% endif %} {% if (fake_ip_ping_hijack): %} - {% if (fake_ip_range ): %} + {% if (fake_ip_range): %} icmp type echo-request ip daddr {{ fake_ip_range }} counter redirect {% endif %} - {% if (fake_ip6_range ): %} + {% if (fake_ip6_range): %} icmpv6 type echo-request ip6 daddr {{ fake_ip6_range }} counter redirect {% endif %} {% endif %} @@ -555,7 +555,7 @@ table inet nikki { {% if (fake_ip_range): %} icmp type echo-request ip daddr {{ fake_ip_range }} counter redirect {% endif %} - {% if (fake_ip6_range ): %} + {% if (fake_ip6_range): %} icmpv6 type echo-request ip6 daddr {{ fake_ip6_range }} counter redirect {% endif %} {% endif %} diff --git a/services/kai/Makefile b/services/kai/Makefile index 00143ac2d..06d1b90b3 100644 --- a/services/kai/Makefile +++ b/services/kai/Makefile @@ -14,7 +14,7 @@ PKG_VERSION:=0.0.1 PKG_RELEASE:=0 PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/ -PKG_HASH:=ac0f198049f3a9c0483c88d5bd48531b3ca0d85a7320291e94d7054afd4ea412 +PKG_HASH:=51b20a41da99dc1b6ab616e203cba824bf644699813316f858055fa6e1343860 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 @@ -56,8 +56,7 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/config - $(INSTALL_BIN) $(PKG_BUILD_DIR)/kai_bin.$(PKG_ARCH_kai) $(1)/usr/sbin/kai_bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/kai_session.$(PKG_ARCH_kai) $(1)/usr/sbin/kai_session + $(INSTALL_BIN) $(PKG_BUILD_DIR)/kai.$(PKG_ARCH_kai) $(1)/usr/sbin/kai_bin $(INSTALL_BIN) ./files/kai.init $(1)/etc/init.d/kai $(INSTALL_BIN) ./files/kai.uci-default $(1)/etc/uci-defaults/09-kai $(INSTALL_CONF) ./files/kai.config $(1)/etc/config/kai diff --git a/services/kai/files/kai.init b/services/kai/files/kai.init index a25597186..bd9dab26a 100755 --- a/services/kai/files/kai.init +++ b/services/kai/files/kai.init @@ -7,14 +7,6 @@ get_config() { config_get_bool enabled $1 enabled 1 } -start_kai_session(){ - procd_open_instance - procd_set_param env OPENCODE_CONFIG http://127.0.0.1:8197/config/opencode/opencode.json - procd_set_param command cd /tmp && /usr/sbin/kai_session --port=8196 --hostname=127.0.0.1 - procd_set_param stderr 1 - procd_set_param respawn - procd_close_instance -} start_kai_bin(){ procd_open_instance procd_set_param command /usr/sbin/kai_bin @@ -22,20 +14,24 @@ start_kai_bin(){ procd_set_param respawn procd_close_instance } - +start_kai_session(){ + procd_open_instance + procd_set_param env OPENCODE_CONFIG="http://127.0.0.1:8197/config/opencode/opencode.json" + procd_set_param command cd /tmp && /usr/sbin/kai_session + procd_append_param command --port "8196" + procd_append_param command --hostname "127.0.0.1" + procd_set_param stderr 1 + procd_set_param respawn + procd_close_instance +} start_service() { config_load kai config_foreach get_config kai [ $enabled != 1 ] && return 1 - start_kai_session start_kai_bin -} - - -kai_prepare() { - killall kai_bin 2>/dev/null - killall kai_session 2>/dev/null + start_kai_session } stop_service() { - kai_prepare + killall kai_bin 2>/dev/null + killall kai_session 2>/dev/null } \ No newline at end of file diff --git a/services/kai_session/Makefile b/services/kai_session/Makefile new file mode 100644 index 000000000..5f507b119 --- /dev/null +++ b/services/kai_session/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# Copyright (C) 2020 jjm2473@gmail.com +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_ARCH_kai:=$(ARCH) + +PKG_NAME:=kai_session +PKG_VERSION:=0.0.1 +PKG_RELEASE:=0 +PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/ +PKG_HASH:=efef8ae3360a682c215b44a908a71480ca064eadc0380f28f2f400edc84807fe +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION) + +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=System + SUBMENU:= + TITLE:=KAI_SESSION + URL:=https://github.com/Carseason/openwrt-packages +endef + +define Package/$(PKG_NAME)/description + KAI is a dashboard & user guide +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/kai +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + if [ -f /etc/uci-defaults/09-kai ]; then + chmod 755 /etc/uci-defaults/09-kai + /etc/uci-defaults/09-kai && rm -f /etc/uci-defaults/09-kai + fi +fi +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/config + $(INSTALL_BIN) $(PKG_BUILD_DIR)/kai_session.$(PKG_ARCH_kai) $(1)/usr/sbin/kai_session +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile index 9c7ba1c4a..4a9c29b08 100644 --- a/v2ray-geodata/Makefile +++ b/v2ray-geodata/Makefile @@ -21,13 +21,13 @@ define Download/geoip HASH:=ed2de9add79623e2e5dbc5930ee39cc7037a7c6e0ecd58ba528b6f73d61457b5 endef -GEOSITE_VER:=20260117053629 +GEOSITE_VER:=20260119054648 GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) define Download/geosite URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ URL_FILE:=dlc.dat FILE:=$(GEOSITE_FILE) - HASH:=b8ae0a67f1abff87fcdef3ae4439984075a7ba6af667fa6d8b5bfe316ccf65c5 + HASH:=0aa20151e866359fd6bc4b94542c208feab71ff8a9552079d790e28b39883492 endef GEOSITE_IRAN_VER:=202601190048