update 2026-10-26 17:35:19

This commit is contained in:
action committed 2026-10-26 17:35:19 +08:00
1 parent 2f2bfddf57
commit 8de6b6ed73
31 files changed
+1833 -486

No files matched your search

+50 -12
View File
@@ -1,19 +1,20 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=clashoo
PKG_SHORT_SHA:=6780eee
PKG_COMMIT_DATE:=2026.10.25
PKG_UPSTREAM_VERSION:=1.19.33
PKG_UPSTREAM_TAG:=v$(PKG_UPSTREAM_VERSION)
PKG_SHORT_SHA:=3f27ef3
PKG_VERSION:=$(PKG_COMMIT_DATE)~$(PKG_SHORT_SHA)
PKG_RELEASE:=3
PKG_VERSION:=2026.10.25.$(PKG_UPSTREAM_VERSION)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-alpha-$(PKG_SHORT_SHA).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-alpha-$(PKG_SHORT_SHA)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-alpha-$(PKG_SHORT_SHA)
PKG_SOURCE:=$(PKG_NAME)-stable-$(PKG_UPSTREAM_TAG)-$(PKG_SHORT_SHA).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-stable-$(PKG_UPSTREAM_TAG)-$(PKG_SHORT_SHA)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_SOURCE_URL:=https://github.com/kenzok8/openwrt-clashoo/releases/download/mihomo-src
PKG_SOURCE_VERSION:=6780eeeb27c7eda5e79a6310a4f7f91ba7cb725d
PKG_HASH:=affb9e916e750c6bd4385c6718660a02cc213936063141fd1c2422011e408b47
PKG_BUILD_VERSION:=alpha-$(PKG_SHORT_SHA)
PKG_SOURCE_VERSION:=3f27ef39f8c96bbfbc8b0b9bb10f5c9ef60149d8
PKG_HASH:=1ef7a4087f3805bd2624a940e2e43a0bc23719a25465c9f503aa6c11572f1321
PKG_BUILD_VERSION:=$(PKG_UPSTREAM_TAG)
PKG_LICENSE:=GPL3.0+
PKG_MAINTAINER:=kenzok8
@@ -50,8 +51,11 @@ endef
define Package/clashoo/install
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/usr/libexec/clashoo
$(INSTALL_DIR) $(1)/usr/bin
ln -sf /usr/bin/mihomo $(1)/usr/bin/clash-meta
mv -f $(1)/usr/bin/mihomo $(1)/usr/libexec/clashoo/mihomo-stable
ln -sf /usr/libexec/clashoo/mihomo-stable $(1)/usr/bin/mihomo
ln -sf /usr/libexec/clashoo/mihomo-stable $(1)/usr/bin/clash-meta
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
@@ -82,10 +86,44 @@ define Package/clashoo/install
$(RM) $(1)/usr/share/clashoo/core_down_complete
endef
define Package/clashoo/preinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
save_core() {
src="$$1"
dst="$$2"
[ -f "$$src" ] && [ ! -L "$$src" ] || return 0
if [ -e "$$dst" ] || [ -L "$$dst" ]; then return 0; fi
mkdir -p "$$(dirname "$$dst")" || return 1
tmp="$$dst.tmp.$$$$"
cp "$$src" "$$tmp" && chmod 0755 "$$tmp" && cmp -s "$$src" "$$tmp" || {
rm -f "$$tmp"
return 1
}
if command -v sha256sum >/dev/null 2>&1; then
old_hash="$$(sha256sum "$$src" | awk '{print $$1}')"
new_hash="$$(sha256sum "$$tmp" | awk '{print $$1}')"
[ "$$old_hash" = "$$new_hash" ] || {
rm -f "$$tmp"
return 1
}
fi
mv -f "$$tmp" "$$dst"
}
save_core /usr/bin/mihomo /usr/share/clashoo/bin/mihomo-alpha || exit 1
save_core /usr/bin/mihomo-stable /usr/share/clashoo/bin/mihomo-stable || exit 1
if [ -x /usr/bin/clash-meta ] && [ ! -L /usr/bin/clash-meta ] && [ ! -e /usr/share/clashoo/bin/mihomo-stable ]; then
if ! /usr/bin/clash-meta -v 2>/dev/null | grep -Eiq '(alpha|beta|rc|pre|smart)'; then
save_core /usr/bin/clash-meta /usr/share/clashoo/bin/mihomo-stable || exit 1
fi
fi
fi
exit 0
endef
define Package/clashoo/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
[ -x /usr/bin/mihomo ] && [ ! -x /usr/bin/clash-meta ] && ln -sf /usr/bin/mihomo /usr/bin/clash-meta
rm -f /usr/share/clashoo/check_luci_version.sh /usr/share/clashoo/check_clash_meta_version.sh /usr/share/clashoo/check_mihomo_core_version.sh
rm -f /usr/share/clashoo/cuslist.sh /usr/share/clashoo/groups.sh /usr/share/clashoo/load_groups.sh /usr/share/clashoo/panel_diag.sh
rm -f /usr/share/clashoo/rmlist.sh /usr/share/clashoo/uplist.sh /usr/share/clashoo/rpc_restart_async.sh /usr/share/clashoo/rpc_update_china_ip_async.sh
+2 -2
View File
@@ -9,7 +9,7 @@ config clashoo 'config'
option dash_port '9090'
option dashboard_panel 'zashboard'
option level 'info'
option core '3'
option core '2'
option allow_lan '1'
option dnsforwader '1'
option subcri 'meta'
@@ -28,7 +28,7 @@ config clashoo 'config'
option listen_port '1053'
option interf '0'
option download_core 'amd64-compatible'
option dcore '3'
option dcore '2'
option same_tag '1'
option geoip_source '3'
option geoip_format 'mmdb'
+47 -37
View File
@@ -169,43 +169,54 @@ cleanup_stale_core_nft() {
}
_core_candidates() {
echo "/usr/bin/mihomo-stable /usr/bin/mihomo /usr/bin/clash-meta /etc/clashoo/clash"
echo "/usr/share/clashoo/bin/mihomo-stable /usr/libexec/clashoo/mihomo-stable /usr/share/clashoo/bin/mihomo-alpha /usr/bin/mihomo /usr/bin/clash-meta /etc/clashoo/clash"
}
_migrate_legacy_mihomo_stable() {
local legacy=/usr/bin/clash-meta version
[ -x /usr/bin/mihomo-stable ] && return 0
local legacy=/usr/bin/clash-meta target=/usr/share/clashoo/bin/mihomo-stable version staged
[ -x "$target" ] && return 0
[ -x "$legacy" ] && [ ! -L "$legacy" ] || return 0
version=$("$legacy" -v 2>/dev/null | head -n 1)
[ -n "$version" ] || return 0
echo "$version" | grep -Eiq '(alpha|beta|rc|pre|smart)' && return 0
cp -f "$legacy" /usr/bin/mihomo-stable 2>/dev/null && chmod 0755 /usr/bin/mihomo-stable
mkdir -p "$(dirname "$target")" || return 1
staged="${target}.$$"
cp -f "$legacy" "$staged" 2>/dev/null && chmod 0755 "$staged" && mv -f "$staged" "$target"
}
_fallback_missing_mihomo_core() {
local selected fallback
is_singbox_selected && return 0
selected="$(uci -q get clashoo.config.core 2>/dev/null)"
case "$selected" in
2)
[ -x /usr/bin/mihomo-stable ] && return 0
[ -x /usr/bin/mihomo ] || return 0
fallback=3
;;
3)
[ -x /usr/bin/mihomo ] && return 0
[ -x /usr/bin/mihomo-stable ] || return 0
fallback=2
;;
*) return 0 ;;
esac
uci -q set clashoo.config.core="$fallback"
uci -q set clashoo.config.dcore="$fallback"
uci -q commit clashoo >/dev/null 2>&1
if [ "$fallback" = "3" ]; then
log_msg "Stable core missing, falling back to Alpha" "稳定版内核缺失,自动回退到 Alpha"
_mihomo_stable_binary() {
local bundled=/usr/libexec/clashoo/mihomo-stable manual=/usr/share/clashoo/bin/mihomo-stable bundled_ver manual_ver
# A successful custom download is an explicit override, even if its version is older.
if [ -x "$manual" ] &&
[ "$(sed -n '1{s/^[[:space:]]*//;s/[[:space:]]*$//;p;}' /usr/share/clashoo/clash_meta_version 2>/dev/null)" = "custom-url" ]; then
echo "$manual"
return 0
fi
[ -x "$bundled" ] || { [ -x "$manual" ] && { echo "$manual"; return 0; }; return 1; }
[ -x "$manual" ] || { echo "$bundled"; return; }
bundled_ver="$("$bundled" -v 2>/dev/null | awk '{for (i = 1; i < NF; i++) if ($i == "Meta") {print $(i + 1); exit}}')"
manual_ver="$("$manual" -v 2>/dev/null | awk '{for (i = 1; i < NF; i++) if ($i == "Meta") {print $(i + 1); exit}}')"
bundled_ver="${bundled_ver#v}"
manual_ver="${manual_ver#v}"
printf '%s\n' "$bundled_ver" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' || bundled_ver=""
printf '%s\n' "$manual_ver" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' || manual_ver=""
if [ -n "$bundled_ver" ] && [ -n "$manual_ver" ]; then
if awk -v manual="$manual_ver" -v bundled="$bundled_ver" 'BEGIN {
split(manual, m, "."); split(bundled, b, ".");
for (i = 1; i <= 3; i++) {
if (m[i] + 0 > b[i] + 0) exit 0;
if (m[i] + 0 < b[i] + 0) exit 1;
}
exit 0;
}'; then
echo "$manual"
else
echo "$bundled"
fi
elif [ -n "$manual_ver" ]; then
echo "$manual"
else
log_msg "Alpha core missing, falling back to stable" "Alpha 内核缺失,自动回退到稳定版"
echo "$bundled"
fi
}
@@ -220,11 +231,11 @@ _detect_selected_core() {
return 1
;;
2|mihomo)
[ -x /usr/bin/mihomo-stable ] && echo /usr/bin/mihomo-stable && return
return 1
_mihomo_stable_binary
return $?
;;
3|mihomo-alpha)
[ -x /usr/bin/mihomo ] && echo /usr/bin/mihomo && return
[ -x /usr/share/clashoo/bin/mihomo-alpha ] && echo /usr/share/clashoo/bin/mihomo-alpha && return
return 1
;;
esac
@@ -233,7 +244,7 @@ _detect_selected_core() {
core_supports_advanced_features() {
case "$CLASH" in
*/mihomo|*/mihomo-stable|*/clash-meta|*/smart)
*/mihomo|*/mihomo-stable|*/mihomo-alpha|*/clash-meta|*/smart)
return 0
;;
*)
@@ -2126,12 +2137,12 @@ _start_validate_core() {
echo "Clashoo" > "$REAL_LOG"
return 1
elif [ "${core:-0}" -eq 2 ] && [ ! -x "$CLASH" ]; then
log_msg "mihomo core not found, detected binary is unavailable: $CLASH" "找不到可用的 mihomo 内核: $CLASH"
log_msg "mihomo stable core not found, detected binary is unavailable: $CLASH" "找不到可用的 mihomo 稳定版内核: $CLASH"
sleep 1
echo "Clashoo" > "$REAL_LOG"
return 1
elif [ "${core:-0}" -eq 3 ] && [ ! -x "$CLASH" ]; then
log_msg "mihomo core not found, detected binary is unavailable: $CLASH" "找不到可用的 mihomo 内核: $CLASH"
log_msg "mihomo Alpha core not found, detected binary is unavailable: $CLASH" "找不到可用的 mihomo Alpha 内核,请在组件更新中安装: $CLASH"
sleep 1
echo "Clashoo" > "$REAL_LOG"
return 1
@@ -2167,10 +2178,10 @@ _start_prepare_config() {
if { egrep -q '^ {0,}rule-providers:' "$CONFIG_YAML" || egrep -q '^ {0,}script:' "$CONFIG_YAML"; } && ! core_supports_advanced_features; then
[ "$_reload_candidate" = "1" ] && return 1
if [ -x /usr/bin/mihomo ]; then
uci set clashoo.config.core="3" && uci commit clashoo
elif [ -x /usr/bin/mihomo-stable ]; then
if [ -n "$(_mihomo_stable_binary)" ]; then
uci set clashoo.config.core="2" && uci commit clashoo
elif [ -x /usr/share/clashoo/bin/mihomo-alpha ]; then
uci set clashoo.config.core="3" && uci commit clashoo
else
log_msg "Current config requires mihomo/clash-meta core" "当前配置需要 mihomo 或 clash-meta 内核"
backend_remove_rules >/dev/null 2>&1
@@ -2407,7 +2418,6 @@ start_service(){
sync_legacy_core_field
_migrate_legacy_mihomo_stable
_fallback_missing_mihomo_core
CLASH="$(_detect_selected_core)"
cleanup_legacy_startup_backups
@@ -120,7 +120,6 @@ set clashoo_china6 {
2400:5280:1400::/38,
2400:5280:1c00::/38,
2400:5280:3400::/38,
2400:5280:4c00::/38,
2400:5280:5000::/36,
2400:5280:6000::/35,
2400:5280:8000::/34,
@@ -962,6 +961,7 @@ set clashoo_china6 {
2402:7d80::/32,
2402:7da0::/32,
2402:7e20::/32,
2402:7ee0::/32,
2402:8180::/32,
2402:8300::/32,
2402:8380::/32,
@@ -1791,7 +1791,11 @@ set clashoo_china6 {
2405:84c0:8050::/48,
2405:84c0:8053::/48,
2405:84c0:8058::/45,
2405:84c0:8060::/43,
2405:84c0:8061::/48,
2405:84c0:8062::/47,
2405:84c0:8064::/46,
2405:84c0:8068::/45,
2405:84c0:8070::/44,
2405:84c0:8080::/41,
2405:84c0:8100::/40,
2405:84c0:8200::/39,
@@ -2050,7 +2054,10 @@ set clashoo_china6 {
2406:840:8a0::/43,
2406:840:8c0::/42,
2406:840:900::/40,
2406:840:a00::/44,
2406:840:a01::/48,
2406:840:a02::/47,
2406:840:a04::/46,
2406:840:a08::/45,
2406:840:a12::/47,
2406:840:a14::/46,
2406:840:a18::/45,
@@ -2248,7 +2255,8 @@ set clashoo_china6 {
2406:840:9610::/44,
2406:840:9630::/44,
2406:840:9640::/43,
2406:840:9660::/46,
2406:840:9660::/48,
2406:840:9662::/47,
2406:840:9664::/47,
2406:840:9667::/48,
2406:840:9668::/45,
@@ -2272,6 +2280,7 @@ set clashoo_china6 {
2406:840:9900::/42,
2406:840:9940::/43,
2406:840:9960::/47,
2406:840:9963::/48,
2406:840:9965::/48,
2406:840:9968::/46,
2406:840:996d::/48,
@@ -3144,8 +3153,7 @@ set clashoo_china6 {
240b:4006::/48,
240b:4006:1000::/43,
240b:4006:1020::/44,
240b:4006:1100::/45,
240b:4006:110c::/46,
240b:4006:1100::/44,
240b:4006:1110::/45,
240b:4006:1118::/46,
240b:4007::/32,
@@ -3261,8 +3269,6 @@ set clashoo_china6 {
2605:9d80:9042::/48,
2605:9d80:9071::/48,
2605:9d80:9092::/48,
2620:57:4004::/47,
2804:1e48:9002::/48,
2a03:f900::/29,
2a04:3e00::/48,
2a04:3e00:2::/47,
@@ -394,16 +394,13 @@ set clashoo_china {
43.92.0.0/15,
43.94.0.0/18,
43.96.0.0/23,
43.96.2.130/32,
43.96.3.0/24,
43.96.4.0/22,
43.96.8.0/22,
43.96.16.130/32,
43.96.18.0/24,
43.96.20.0/22,
43.96.24.0/22,
43.96.32.0/22,
43.96.36.130/32,
43.96.40.0/24,
43.96.42.0/24,
43.96.44.0/23,
@@ -414,7 +411,6 @@ set clashoo_china {
43.96.62.0/23,
43.96.64.0/21,
43.96.72.0/22,
43.96.77.131/32,
43.96.78.0/24,
43.96.80.0/23,
43.96.85.0/24,
@@ -459,8 +455,7 @@ set clashoo_china {
43.123.0.0/17,
43.123.128.0/18,
43.124.0.0/16,
43.125.0.0/20,
43.125.24.0/21,
43.125.0.0/19,
43.125.32.0/20,
43.125.48.0/21,
43.126.0.0/17,
@@ -805,6 +800,7 @@ set clashoo_china {
45.117.68.0/22,
45.117.124.0/22,
45.117.252.0/22,
45.119.42.0/23,
45.119.60.0/22,
45.119.64.0/21,
45.119.72.0/22,
@@ -1124,6 +1120,7 @@ set clashoo_china {
47.246.192.0/20,
47.246.208.0/23,
47.246.212.0/22,
47.246.216.0/22,
47.250.0.0/18,
47.250.68.0/22,
47.250.72.0/21,
@@ -1478,8 +1475,7 @@ set clashoo_china {
103.8.108.0/22,
103.8.156.0/22,
103.8.200.0/21,
103.8.221.0/24,
103.8.222.0/23,
103.8.220.0/22,
103.9.8.0/22,
103.9.24.0/22,
103.9.108.0/22,
@@ -2113,7 +2109,6 @@ set clashoo_china {
103.89.184.0/21,
103.89.192.0/19,
103.89.224.0/21,
103.90.51.0/24,
103.90.52.0/22,
103.90.56.0/23,
103.90.92.0/22,
@@ -2683,6 +2678,7 @@ set clashoo_china {
103.186.228.0/23,
103.189.92.0/23,
103.189.152.0/22,
103.189.197.0/24,
103.190.20.0/23,
103.190.71.0/24,
103.190.104.0/23,
@@ -4062,10 +4058,6 @@ set clashoo_china {
124.67.0.0/16,
124.68.16.0/20,
124.68.64.0/18,
124.68.176.0/20,
124.68.224.0/20,
124.68.244.0/22,
124.68.248.0/21,
124.69.0.0/16,
124.70.0.0/16,
124.71.0.0/17,
@@ -4445,6 +4437,7 @@ set clashoo_china {
160.202.62.0/24,
160.202.148.0/22,
160.202.152.0/22,
160.202.210.0/23,
160.202.212.0/22,
160.202.216.0/21,
160.202.224.0/19,
@@ -4741,6 +4734,7 @@ set clashoo_china {
192.140.160.0/19,
192.140.192.0/20,
192.140.208.0/21,
192.140.244.0/23,
192.144.128.0/17,
192.163.11.0/24,
192.232.34.0/23,
@@ -6497,12 +6491,14 @@ set clashoo_china {
223.112.0.0/14,
223.116.0.0/15,
223.121.128.0/17,
223.122.4.0/22,
223.122.12.0/22,
223.122.5.0/24,
223.122.6.0/23,
223.122.13.0/24,
223.122.14.0/23,
223.122.18.0/23,
223.122.20.0/22,
223.122.26.0/23,
223.122.28.0/22,
223.122.28.0/23,
223.123.196.0/22,
223.123.204.0/22,
223.123.208.0/20,
Binary file not shown.
Binary file not shown.
@@ -1062,10 +1062,10 @@ if [ -n "$CUSTOM_CORE_URL" ]; then
write_log "使用自定义内核下载链接"
URL="$CUSTOM_CORE_URL"
if [ "$CORETYPE" = "3" ]; then
TARGET="/usr/bin/mihomo"
TARGET="/usr/share/clashoo/bin/mihomo-alpha"
VERSION_FILE="/usr/share/clashoo/mihomo_version"
else
TARGET="/usr/bin/mihomo-stable"
TARGET="/usr/share/clashoo/bin/mihomo-stable"
VERSION_FILE="/usr/share/clashoo/clash_meta_version"
fi
TAG="custom"
@@ -1175,7 +1175,7 @@ elif [ "$CORETYPE" = "2" ]; then
[ -z "$TAG" ] && write_log "获取稳定版版本号失败" && exit 1
ASSET=$(pick_mihomo_asset "MetaCubeX/mihomo" "$TAG" "$(map_mihomo_arch "$MODELTYPE")" "stable")
URL="https://github.com/MetaCubeX/mihomo/releases/download/${TAG}/${ASSET}"
TARGET="/usr/bin/mihomo-stable"
TARGET="/usr/share/clashoo/bin/mihomo-stable"
VERSION_FILE="/usr/share/clashoo/clash_meta_version"
VERSION_VALUE="$TAG"
else
@@ -1189,7 +1189,7 @@ else
[ -z "$ASSET" ] && ASSET=$(pick_mihomo_asset "MetaCubeX/mihomo" "$TAG" "$(map_mihomo_arch "$MODELTYPE")" "alpha")
[ -z "$ASSET" ] && ASSET=$(pick_mihomo_asset "MetaCubeX/mihomo" "$TAG" "$(map_mihomo_arch "$MODELTYPE")" "stable")
URL="https://github.com/MetaCubeX/mihomo/releases/download/${TAG}/${ASSET}"
TARGET="/usr/bin/mihomo"
TARGET="/usr/share/clashoo/bin/mihomo-alpha"
VERSION_FILE="/usr/share/clashoo/mihomo_version"
VERSION_VALUE="$(printf '%s\n' "$ASSET" | sed -n 's#^mihomo-.*-alpha-\([0-9a-fA-F]\{7,\}\)\.gz$#\1#p' | head -n 1)"
[ -z "$VERSION_VALUE" ] && VERSION_VALUE="$TAG"